-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Code blocks in Wiki are rendered with arbitrary syntax highlighting instead of none #11825
Comments
This is not the fault of goldmark. Gitea uses highlightjs for syntax highlighting of code blocks and as far as I understand highlightjs will automatically attempt to detect the language. It's probable that if you put |
Valid bug. We should put the |
An automatically selected highlighting is welcome – just not when it is not expected. I could not find a documentation of this feature before.
|
This PR does a few things: * Remove all traces of highlight.js * Use chroma library to provide fast syntax hilighting directly on the server * Provide syntax hilighting for diffs * Re-style both unified and split diffs views * Add custom syntax hilighting styling for both regular and arc-green Fixes go-gitea#7729 Fixes go-gitea#10157 Fixes go-gitea#11825 Fixes go-gitea#7728 Fixes go-gitea#3872 Fixes go-gitea#3682 And perhaps gets closer to go-gitea#9553
* Server-side syntax hilighting for all code This PR does a few things: * Remove all traces of highlight.js * Use chroma library to provide fast syntax hilighting directly on the server * Provide syntax hilighting for diffs * Re-style both unified and split diffs views * Add custom syntax hilighting styling for both regular and arc-green Fixes #7729 Fixes #10157 Fixes #11825 Fixes #7728 Fixes #3872 Fixes #3682 And perhaps gets closer to #9553 * fix line marker * fix repo search * Fix single line select * properly load settings * npm uninstall highlight.js * review suggestion * code review * forgot to call function * fix test * Apply suggestions from code review suggestions from @silverwind thanks Co-authored-by: silverwind <me@silverwind.io> * code review * copy/paste error * Use const for highlight size limit * Update web_src/less/_repository.less Co-authored-by: Lauris BH <lauris@nix.lv> * update size limit to 1MB and other styling tweaks * fix highlighting for certain diff sections * fix test * add worker back as suggested Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lauris BH <lauris@nix.lv>
* Server-side syntax hilighting for all code This PR does a few things: * Remove all traces of highlight.js * Use chroma library to provide fast syntax hilighting directly on the server * Provide syntax hilighting for diffs * Re-style both unified and split diffs views * Add custom syntax hilighting styling for both regular and arc-green Fixes go-gitea#7729 Fixes go-gitea#10157 Fixes go-gitea#11825 Fixes go-gitea#7728 Fixes go-gitea#3872 Fixes go-gitea#3682 And perhaps gets closer to go-gitea#9553 * fix line marker * fix repo search * Fix single line select * properly load settings * npm uninstall highlight.js * review suggestion * code review * forgot to call function * fix test * Apply suggestions from code review suggestions from @silverwind thanks Co-authored-by: silverwind <me@silverwind.io> * code review * copy/paste error * Use const for highlight size limit * Update web_src/less/_repository.less Co-authored-by: Lauris BH <lauris@nix.lv> * update size limit to 1MB and other styling tweaks * fix highlighting for certain diff sections * fix test * add worker back as suggested Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lauris BH <lauris@nix.lv>
Description
When adding a code block on a page in the built-in wiki, but with no language given for syntax highlighting, this block will be rendered using an arbitrarily chosen highlighting. Code blocks without selected syntax I will set like this:
Even if the text inside the block would contain keywords for some languages, I do not expect them to be highlighted or rendered other than as fixed-width font. In fact when given no language for the code block, I expect the language to be None.
Actual result
When selecting the preview window, or after storing the page, a second later a seemingly arbitrarily chosen syntax highlighting is applied to the block. On the example page I added some keywords (for some languages), and the two blocks are rendered as Cal and Vim, respectively. It seems the highlighting is selected automatically given the content of the block.
Workaround
I can enclose the block with
<pre>
/</pre>
instead of Markdown. Is there otherwise a possibility to have a non-syntaxed code block with Markdown syntax?Edit:
<pre>
does not set the content to a fixed-width font, so this is unfortunately no solution.Is this a bug for Gitea? Or should I file a bug on the Markdown interpreter used (goldmark?).
The text was updated successfully, but these errors were encountered: