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.