Fix highlightjs_al for Highlight.js v11 - #8306
Open
Torben Leth (SShadowS) wants to merge 1 commit into
Open
Conversation
Two corrections to the AL grammar, and a rebuilt dist. The preprocessor mode uses the `meta-keyword` keyword group, which Highlight.js replaced with a nested `.meta .keyword` scope in v11 (highlightjs/highlight.js#3167, VERSION_11_UPGRADE.md). The default and mainstream themes no longer style the old class, so the directive keywords render unstyled: before: <span class="hljs-meta">#<span class="hljs-meta-keyword">pragma</span> ... after: <span class="hljs-meta">#<span class="hljs-keyword">pragma</span> ... Auto-detection is also disabled. Running Highlight.js's 192 core detect fixtures with this grammar registered, AL takes exactly one that is not its own: cal, the C/AL fixture. That is expected, since C/AL is AL's predecessor and the two are near identical to a heuristic, and it is the situation the third party guide names as the reason to set disableAutodetect. Explicit registration and language-al are unaffected; highlightAuto callers lose AL detection. dist/al.min.js is regenerated, since it is committed here and is the only artifact consumers can load while the package is unpublished. Verified against a Highlight.js 11.11.2 build with this package linked into extra/.
Torben Leth (SShadowS)
force-pushed
the
fix-highlightjs-al-v11
branch
from
August 8, 2026 17:59
3ec7c8e to
39ed16f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two fixes to
highlightjs_alfor Highlight.js v11, plus the regenerateddist.meta-keywordis a v10 scopeThe preprocessor mode uses the
meta-keywordkeyword group. Highlight.js replaced that with a nested.meta .keywordscope in v11 (#3167, noted inVERSION_11_UPGRADE.md). The class is still emitted, but the default theme and the mainstream ones (github, atom-one, and so on) no longer style it, so#pragma,#regionand the rest render unstyled for most users. A few older themes such as agate and the base16 family do still carry the selector.Verified against a Highlight.js 11.11.2 build with this package linked into
extra/:The new form matches how core grammars write it, for example
src/languages/c.js.Auto-detection
Disabled, for a measured reason. Running Highlight.js's 192 core detect fixtures with this grammar registered, AL takes exactly one fixture that is not its own:
cal, the C/AL fixture, at relevance 51.That is not surprising, since C/AL is AL's predecessor and the two are near identical to a heuristic. It does mean that anyone linking this package breaks Highlight.js's own detect suite, which is the situation
extra/3RD_PARTY_QUICK_START.mdnames as the reason to setdisableAutodetect.Worth being precise about what this costs:
highlightAutocallers lose AL detection. Explicit registration and```alfences are unaffected, sincealiasesis unchanged. AL was not confused with Pascal or Delphi in that run; both of those fixtures still detect correctly.dist
dist/al.min.jsis committed here and, while the package is unpublished, is the only artifact a consumer can actually load. It still contained the oldmeta-keywordoutput, so it is regenerated with the Highlight.js CDN build.Background
I started writing a competing AL grammar for Highlight.js, found this one was better, and contributed these fixes instead.
Separately, #8307 asks about publishing this package to npm, since Highlight.js discovers third party grammars through its
SUPPORTED_LANGUAGES.mdlist and AL is absent from it today.AI disclosure
This change was prepared with AI assistance (Claude). The before and after output and the detect fixture run above were produced locally against Highlight.js 11.11.2.