fix: use Tree.Root.String() for JS/CSS extraction to avoid html/template escaping#12
Merged
jonathanpopham merged 1 commit intomainfrom Feb 28, 2026
Merged
Conversation
…ate escaping RenderJS() and RenderCSS() were running static assets through html/template's Execute(), which HTML-escapes < to < in the output. This broke all for-loops and comparisons in main.js (8 instances), causing a syntax error that prevented all D3 graphs from rendering. Same root cause as the template.HTML → template.JS fix: the text/template → html/template migration in 8f1470b.
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.
Fixes the remaining graph rendering issue from #10.
Summary
RenderJS()andRenderCSS()were running_main.jsand_styles.cssthroughhtml/template'sExecute(), which HTML-escapes<to<. This broke every for-loop and comparison inmain.js(8 instances), causing a JS syntax error that killed the entire script before D3 graph rendering code could execute.Same root cause as the
template.HTML→template.JSfix merged in #11: thetext/template→html/templatemigration in8f1470b.Fix
Use
t.Tree.Root.String()instead oft.Execute()to return the raw template source without html/template's context-aware escaping. These files are static assets with no Go template directives.Verified locally
node --check main.jspasses (was failing withUnexpected token ';'before)