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

Spurious {1} inserted into autodetect code highlighting when numbering enabled. #167

Open
T3P3 opened this issue Nov 4, 2021 · 1 comment

Comments

@T3P3
Copy link

T3P3 commented Nov 4, 2021

There is a bug where specific words in a code block set to use line numbering will cause some empty following lines to have spurious {1} text inserted in it. e.g.:
image

this can be confirmed by inspecting the <code class> element it will be set to hljs sql for blocks with this issue and hljs perl or other wise for blocks of code without this issue.

This only happens if the code language is autodetected as SQL (hence why the specific words are needed to trigger the highlight.js autodetection for SQL). if the language type is set to SQL or any other type it does not happen:

image

If line numbering for SQL is turned off in the markdown plugin settings it does not happen:
image
(note no line numbering, no {1})

So we can work around this issue by just not having line numbering for SQL as we don't post SQL frequently/at all on our forum.

Versions:

NodeBB version: 1.18.5 (although we have had this issue from at least 1.16)
Markdown plugin version: 8.14.4

@julianlam
Copy link
Member

Ah... this one's hard to debug because I just refactored the plugin a bit and it now uses the latest version of hljs and the line-numbering plugin.

So with that example text, for whatever reason it is now detected as vbnet, not sql, and I can't actually reproduce the {1} issue.

Can you try with the latest markdown plugin and let me know?

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