Skip to content
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

[HELP] Highlighted Syntax code blocks #71

Open
davidegurgone opened this issue Mar 14, 2021 · 2 comments
Open

[HELP] Highlighted Syntax code blocks #71

davidegurgone opened this issue Mar 14, 2021 · 2 comments

Comments

@davidegurgone
Copy link

Hi,
thanks for this precious job!

I am trying to integrate this library for formatting code documentation, how did you integrate syntax highlighting?
There is an extension for that?

Thanks a lot, Davide.

@davidegurgone
Copy link
Author

After some search I finally found the trick:
The library renders code in this way:

<pre><code class="language-java">String foo=&quot;BAR&quot;;
for (int i=0; i&lt;10; 1++) {
	System.out.println(foo + i);
}
</code></pre>

language-java is used by PrismJS client side library to syntax highlight the code in the browser.

@valich
Copy link
Collaborator

valich commented Mar 22, 2021

Hi @davidegurgone, thanks for the kind words.

Generated html contains language in class indeed (source), there is no default way to highlight it. IntelliJ IDEA, for example, uses own syntax highlighting engine for highlighting code blocks in preview. I think using PrismJS is a good choice!

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

No branches or pull requests

2 participants