Skip to content

Roundup PR: optional code features, custom-theme improvements + curated community PRs - #301

Open
DrPepperBianco wants to merge 15 commits into
simov:mainfrom
DrPepperBianco:feature/enhancements
Open

Roundup PR: optional code features, custom-theme improvements + curated community PRs#301
DrPepperBianco wants to merge 15 commits into
simov:mainfrom
DrPepperBianco:feature/enhancements

Conversation

@DrPepperBianco

Copy link
Copy Markdown

Summary

This is a roundup PR bundling several independent changes; each can be split out into its own PR on request.

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/enhancementssimov:main

Happy to split this into separate PRs if that is easier to review.

New options / features (original work in this branch)

  • Wrap long lines in code blocks — new content.codewrap option (default
    off). When enabled, fenced code blocks wrap (white-space: pre-wrap) instead
    of scrolling horizontally, with a hanging indent so wrapped lines stay
    distinguishable. Mermaid diagram containers are excluded.
  • Extend a base theme in custom themes — a custom theme can now pick a base
    theme (e.g. github-dark) and only override parts of it, instead of shipping
    a full stylesheet. Uses less storage.
  • Per-device local storage for custom themes — custom themes can be stored
    in chrome.storage.local (no 8KB item limit) as a per-device override; when
    a 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.
  • Fix mdc build on newer Nodenode-sass no longer builds on current
    Node/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.

Intentionally NOT included (and why)

Notes

  • Every feature is opt-in and defaults to the current behavior.
  • The themes/ and vendor/ build artifacts are not included (they are
    git-ignored); #233 needs a markdown-it vendor rebuild, which
    build/package.sh handles.
  • README and CHANGELOG are updated accordingly.

geauxtigers and others added 15 commits July 9, 2026 17:32
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>
@uablrek

uablrek commented Jul 25, 2026

Copy link
Copy Markdown

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.

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.

6 participants