Skip to content

Optimize syntax highlighting, minor web cleanup#27

Merged
KockaAdmiralac merged 4 commits intoutdrwiki:masterfrom
HushBugger:optimize-scripts
Mar 26, 2026
Merged

Optimize syntax highlighting, minor web cleanup#27
KockaAdmiralac merged 4 commits intoutdrwiki:masterfrom
HushBugger:optimize-scripts

Conversation

@HushBugger
Copy link
Copy Markdown

  1. Make syntax highlighting of large files much faster. Especially on Firefox loading https://code.deltarune.wiki/ch4/gml_globalscript_scr_text takes ages and blocks the page while highlighting happens, now it takes less time and doesn't block the page.
    The new code processes the HTML manually, which I don't like much, but none of the other tricks I tried helped.
  2. Escape < and & to avoid HTML injection. This makes "<DELTARUNE.>" show up properly. (I had to make some additional changes to prevent double-escaping but I think I got it right.)
  3. Use DOMContentLoaded instead of duplicating script.js at the start and the end of the page.
  4. Add a pure-CSS fallback for highlighting the selected line (:target). It now works when JS is disabled. But the innerHTML trick from 1 breaks it so we also need the old version.

@KockaAdmiralac
Copy link
Copy Markdown
Member

Thanks!

@KockaAdmiralac KockaAdmiralac merged commit 9db25c1 into utdrwiki:master Mar 26, 2026
1 check passed
@HushBugger HushBugger deleted the optimize-scripts branch March 27, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants