highlightjs / highlight.js

JavaScript syntax highlighter with language auto-detection and zero dependencies.
https://highlightjs.org/
BSD 3-Clause "New" or "Revised" License
23.76k stars 3.61k forks source link

(apache) continuation lines are not recognized #4157

Open bmarwell opened 3 weeks ago

bmarwell commented 3 weeks ago

Describe the issue

Given this snippet:

<IfModule mod_deflate.c>
 AddOutputFilterByType DEFLATE "application/atom+xml" \
 "application/javascript" \
 "text/xml"
</IfModule>

The line continuation marks (\) are not recogniezed. Everything following the first line ending with a continuation mark will not be highlighted correctly.

Which language seems to have the issue? apache aka apacheconf

Are you using highlight or highlightAuto?

highlight="apache" in vue (but can reproduce on vanilla highlightjs)

Sample Code to Reproduce

See: https://jsfiddle.net/L52ndpkb/

Screenshot:

Screenshot 2024-11-01 at 11 36 13

Expected behavior

Same highlighting as without continuation lines:

Screenshot 2024-11-01 at 11 37 11

Additional context

./.

joshgoebel commented 3 weeks ago

If you can build source you can try my fix.

bmarwell commented 2 weeks ago

Thanks, will try on Monday. Great response! I hope the description was clear and reproducible. I love the idea of including a fiddle link in the issue template, that was very helpful for documenting the reproducer. Great work! 👍🏻

bmarwell commented 2 weeks ago

Hi, I cannot build it myself, but as far as I can tell, the patch looks correct :)