Roundup PR: optional code features, custom-theme improvements + curated community PRs - #301
Open
DrPepperBianco wants to merge 15 commits into
Open
Roundup PR: optional code features, custom-theme improvements + curated community PRs#301DrPepperBianco wants to merge 15 commits into
DrPepperBianco wants to merge 15 commits into
Conversation
Cherry-picked from upstream PR simov#291 (geauxtigers). The original PR also reran content/index.css through a formatter (reindent + stripped comments); that unrelated churn was dropped. Only the copy-button rules are appended to the untouched stylesheet. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
node-sass 9 needs a native build via node-gyp, which fails on current Node/Windows (it is deprecated and ships no working prebuilt binary). Switch the mdc stylesheet step to dart-sass (pure JS), so vendor/mdc.min.* is produced again and the popup and options page render their Material switches instead of raw, misaligned checkboxes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a codewrap content option (default off). When enabled the content script toggles a _code-wrap class on the body, and the stylesheet forces white-space: pre-wrap on fenced code blocks across the github themes, the other themes and prism-highlighted blocks, so long lines wrap instead of showing a horizontal scrollbar. Wrapped lines get a hanging indent (text-indent each-line) so they stay distinguishable from real code lines. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Custom themes gain three abilities: - extend a base theme (custom.base): the content script loads the base theme stylesheet plus the user overrides and inherits its wrapper class and color scheme - be stored per device in chrome.storage.local as an override that wins over the synced theme on that device; choosing sync falls back to local automatically when the theme exceeds the 8KB sync item quota - a css textarea in the options editor alongside the file upload The local flag is derived per device from local storage and never synced, so a locally stored theme on one device no longer leaves another device with an empty theme. Also fix quota detection, which no longer matched the current Resource::kQuotaBytesPerItem error string. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cherry-picked from upstream PR simov#290. Avoids errors when detect runs before the state is loaded (missing url/origins) and when notifyContent has no active tab or the content script is not present. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cherry-picked from upstream PR simov#281. Adds a content option that, when enabled, renders the yaml/toml frontmatter as a fenced code block instead of stripping it. Frontmatter is still stripped by default. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cherry-picked from upstream PR simov#233. Adds an optional markdown-it compiler option for pandoc-style grid_tables via markdown-it-gridtables. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Based on upstream PR simov#289 (issue simov#263). The github theme hides <br> inside code elements, so multi-line mermaid labels did not render. Only the css fix is taken; the PR's securityLevel 'loose' change is omitted as it widens the html injection surface for untrusted files. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR simov#281 (frontmatter) and PR simov#233 (grid tables) added new option defaults but no standalone migration, so existing installs lacked the keys. The popup renders content and compiler toggles from the stored state keys, so those toggles never showed up for existing installs. Also lift the grid table migration out of the pre-v5.2 markdown-it block, where it only ran for very old installs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The code wrap rules also matched the mermaid <pre>, so the hanging indent (text-indent/padding-left) shifted and clipped the rendered diagrams. Skip pre:has(> code.mermaid) and code.mermaid. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The copy button only targeted code[class*="language-"], so fenced blocks without a language tag got none. Match all pre > code instead and skip mermaid diagrams. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Document the code wrap, frontmatter and grid table options, and the extended custom theme (base theme + sync/local storage). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Trying various workarounds for #304, I applied this patch and rebuilt/installed, but it still doesn't work. I did like described in #304 (comment). @DrPepperBianco Please tell me if I am missing something. |
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.
Summary
This branch collects several optional, off-by-default enhancements plus a
build fix, and consolidates a few sound but currently unmerged community PRs
into one place. Nothing changes the default behavior — every new option starts
disabled and existing installs keep working as before.
Compare:
DrPepperBianco:feature/enhancements→simov:mainHappy to split this into separate PRs if that is easier to review.
New options / features (original work in this branch)
content.codewrapoption (defaultoff). When enabled, fenced code blocks wrap (
white-space: pre-wrap) insteadof scrolling horizontally, with a hanging indent so wrapped lines stay
distinguishable. Mermaid diagram containers are excluded.
theme (e.g.
github-dark) and only override parts of it, instead of shippinga full stylesheet. Uses less storage.
in
chrome.storage.local(no 8KB item limit) as a per-device override; whena synced theme exceeds the sync item quota it falls back to local storage
automatically. The options editor also gains a CSS text field next to the
file upload.
node-sassno longer builds on currentNode/Windows (deprecated, no working prebuilt binary); switched the mdc
stylesheet step to
dart-sass.Consolidated community PRs (with attribution)
These were rebased/cherry-picked; original commit authorship is preserved.
trimmed: the original also re-ran
content/index.cssthrough a formatter(reindent + stripped comments); that unrelated churn was dropped, keeping only
the copy-button rules.
@geauxtigers). Taken as-is; avoids errors when
detectruns before state isloaded and when
notifyContenthas no active tab / content script.Taken; additionally added the missing storage migration so the toggle also
appears for existing installs.
migration out of the pre-v5.2 block so it also runs for existing installs.
<br>line breaks in mermaid node labels (by @koyo922).Partially taken: only the CSS fix (the github theme hides
<br>insidecode). The PR'ssecurityLevel: 'loose'change was intentionally omitted,as it widens the HTML/JS injection surface for untrusted markdown files.
Intentionally NOT included (and why)
implementation from Add optional copy buttons for fenced code blocks #291 (no dependency on the Prism toolbar, works without a
vendor rebuild).
button overlaps Add optional copy buttons for fenced code blocks #291; the popup previewer is a large, separate feature that
also bundles unrelated prism/mathjax changes.
(injects MathJax from a CDN in the content script); incompatible with the
current vendor-based MathJax and the extension's offline/CSP design.
been rewritten; would not integrate cleanly, and the code quality is low.
markdown-it 13 → 14, relies on a manual "patch the vendor bundle" TODO,
disables the themes build, and adds a stray root
package.json.(significant bundle size increase) for a niche use case.
Notes
themes/andvendor/build artifacts are not included (they aregit-ignored);
#233needs amarkdown-itvendor rebuild, whichbuild/package.shhandles.