Skip to content

No code highlight in preview #437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
limejuly opened this issue Sep 10, 2021 · 3 comments
Closed

No code highlight in preview #437

limejuly opened this issue Sep 10, 2021 · 3 comments

Comments

@limejuly
Copy link

Description

In the preview window, no code highlight is generated.

System Information

Version: 1.60.0
Commit: e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff
Date: 2021-09-01T10:54:53.442Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 20.5.0

To Reproduce

Steps to reproduce the issue:

  1. add some simple codes of any language.
  2. open preview window
  3. see if code highlight is shown.

Screenshots & Files

截屏2021-09-11 上午12 44 09

@ggrossetie
Copy link
Member

You need to enable source highligthing using :source-highlighter: highlight.js.

vscode-syntax-highligter

Reference: https://docs.asciidoctor.org/asciidoc/latest/verbatim/source-highlighter/

@limejuly
Copy link
Author

@Mogztter Thanks. That is the most important thing I missed.

And also, I find another step needed. Even if this line is added, vscode would prevent it from rendering. In the bottom of preview window, it would say "Some content has been disabled in this document". Seems like highlight.js contents are not https. To get it work, one should click it and set it to Disable.

@ggrossetie
Copy link
Member

Thanks for the follow-up.
We are loading Highlight.js through HTTPS but we do not use the Subresource Integrity feature and I think that's the reason why VS Code consider that this is unsafe: https://developer.mozilla.org/fr/docs/Web/Security/Subresource_Integrity

Hopefully, #440 will make a more seamless integration of Highlight.js in VS Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants