Code fences don't seem to deal with C comments

Done.

https://github.com/isagalaev/highlight.js/issues/937

The example worked differently there, but still cpp versus nothing was different.

2 Likes

Careful, github do not use highlight js, it needs to be tested on highlight js latest, will upgrade us next week just in case

Hey there! The author of highlight.js here :slight_smile:

@codinghorror is spot on: indeed this code is recognized as something else because there’s enough of interesting stuff happening within the comment. This is one of the cases where heuristics fails and that’s why we have the ability to set the language explicitly — don’t refrain from using it!

Having said that, I think it will be possible to improve our heuristics across the board so highlighting of this comment will probably be fixed as a side effect.

8 Likes

Super awesome, and thanks for highlight, let us know if you need us to test anything

Super awesome

https://github.com/isagalaev/highlight.js/commit/266e03e0e9d6a782c0c499235c3d3b4fe509ae81

5 Likes

I suppose everyone here realizes that the issue is still showing meta.

But I now have another question about code fence implementation with Discourse.

My understanding is that the opening and closing fences need to be at least 3 ` long and opening and closing fences must be the same length. In this way, you can fence in anything you want, containing an arbitrary number of `s on a line. A contrived example, this input should properly quote the code fence in the here-documents:


````bash
perl reportprogram > $tmpfile
(cat <<“ReportHeader”; cat $tmpfile; cat <<“ReportFooter”) | perl post-to-discourse
This is a report I generated.
```
ReportHeader
```
Feel free to ask questions.
ReportFooter
````

Actual results:

perl reportprogram > $tmpfile
(cat <<"ReportHeader"; cat $tmpfile; cat <<"ReportFooter") | perl post-to-discourse
This is a report I generated.
```
ReportHeader
```
Feel free to ask questions.
ReportFooter

The markdown implementation in Discourse does not (yet) follow the Commonmark standard. So anything outside of the original markdown “spec” should be considered unimplemented for now; and any non-standard markdown that works as pure coincidence.

2 Likes