SIGN IN SIGN UP

fix(markdown): only highlight code blocks with explicit language class (#559)

* fix(markdown): only highlight code blocks with explicit language class

hljs.highlightAll() applies auto-detection to all <pre><code> blocks,
including those without a language-* class from markdown code fences
with no language specified.

Replace with selective highlightElement(): only target code blocks
that have an explicit language-* class, skip language-plain.

Closes OpenListTeam/OpenList#2342

* fix(markdown): skip plaintext/text and check hljs.getLanguage()

- Add language-plaintext and language-text to the skip set
- Use hljs.getLanguage() to verify the language is supported by Highlight.js
  before calling highlightElement(), preventing unnecessary handling of
  unknown language classes

---------

Co-authored-by: lezi-fun <177434121+lezi-fun@users.noreply.github.com>
L
lezi-fun committed
494fc3e9585fb3442f46a407d7c8c87a2fa3abae
Parent: 512356a
Committed by GitHub <noreply@github.com> on 7/9/2026, 9:00:08 AM