Fix: markdown-previewer - dark mode toggle not working - #834
Merged
praveenscience merged 1 commit intoAug 15, 2026
Merged
Conversation
praveenscience
approved these changes
Aug 15, 2026
praveenscience
left a comment
Owner
There was a problem hiding this comment.
The three fixes are correct:
let dark = falsemoved abovetoggleTheme()call — fixes temporal dead zone issuelet currentView = "both"moved abovesetView()call — same fixmode→currentViewinlocalStorage.setItem—modewas out of scope (it is a parameter ofsetView(), not available at line 577)
Note: There is a remaining bug at lines 575–578 — setView("both") always overwrites the restored view from localStorage, and then saves "both" back, wiping the user preference. Will create a follow-up issue for this.
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.
What does this PR do?
Fixes the dark mode toggle in the Markdown Previewer tool. The moon/sun button did nothing because a
ReferenceErrorat script load (the view-restore block calledsetView()beforelet currentViewwas declared, i.e. a temporal-dead-zone violation) aborted the rest of the inline script — sotoggleTheme()was never set up. Moved the state declarations (dark,currentView) above their restore blocks and fixed the view-persistence save to use the correct variable.Closes #833
Type of Change
Screenshot
Checklist
add/tool-name,feat/description, orfix/description)For new tools:
.htmlfile in thetools/folderjson-formatter.html)data/tools.jsonwith all required fieldstools/<tool-name>.pngnext to the HTML filenode scripts/sort-norm.js data/tools.jsonto sort and normalize the tools registrynode scripts/build.jsand verified the landing page renders correctlyFor enhancements / bug fixes: