Add user-defined CSS themes via themes directory - #56
Merged
Conversation
- New internal/themes package: manages built-in CSS (github, simple, dark) and user-defined CSS files in ~/.config/markdown-proxy/themes/ - On first launch, writes built-in theme files to the themes directory so users can edit or replace them - Server scans themes directory at startup and populates theme dropdown dynamically (new /_theme/<name>.css endpoint) - CSS architecture changed: structural layout stays embedded; all visual styling (colors, fonts, borders, syntax highlighting) lives in theme files - Theme switching swaps <link> href instead of toggling body class; preserves toc-visible and other non-theme body classes - Theme names from localStorage are validated against MDPROXY_THEMES list - Built-in chroma syntax highlight CSS is scoped under .chroma to avoid polluting global namespace Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Closes #55
Summary
internal/themespackage manages built-in and user-defined CSS theme filesgithub.css,simple.css,dark.cssto~/.config/markdown-proxy/themes/— users can edit or replace them.cssfile placed in the themes directory is automatically listed in the theme dropdown/_theme/<name>.cssendpoint serves CSS files from the themes directory (with path traversal protection and in-memory fallback)Architecture changes
<link id="theme-css">href instead of toggling body class — no page reload requiredtheme-<name>for Mermaid dark-mode detection; non-theme classes (e.g.toc-visible) are preserved on switchMDPROXY_THEMESJS array before applying.chromain each theme file to avoid polluting global selectorsTest plan
github.css,simple.css,dark.cssto~/.config/markdown-proxy/themes/.cssfile to the themes directory and restarting makes it appear in the dropdowngo test ./...passes🤖 Generated with Claude Code