From f114574d4b6645367426601442709a20c369670f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naz=C4=B1m=20Can=20Alt=C4=B1nova?= Date: Thu, 19 Feb 2026 10:37:10 +0100 Subject: [PATCH] Fallback to javascript highlighting in the source view as a backup --- src/components/shared/SourceView-codemirror.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/shared/SourceView-codemirror.ts b/src/components/shared/SourceView-codemirror.ts index 5365efbe54..6ddf2823b0 100644 --- a/src/components/shared/SourceView-codemirror.ts +++ b/src/components/shared/SourceView-codemirror.ts @@ -77,7 +77,11 @@ function _languageExtForPath( ) { return cpp(); } - return []; + + // Fallback to JavaScript highlighting. Inline scripts share the page URL, so + // their path won't have a .js extension. This may be incorrect for + // unknown/unsupported file types, but is the best guess for the common case. + return javascript(); } // Adjustments to make a CodeMirror editor work as a non-editable code viewer.