Skip to content

feat: add configurable default theme option#16

Open
gogongxt wants to merge 1 commit intoselimacerbas:mainfrom
gogongxt:feat/theme-config
Open

feat: add configurable default theme option#16
gogongxt wants to merge 1 commit intoselimacerbas:mainfrom
gogongxt:feat/theme-config

Conversation

@gogongxt
Copy link
Copy Markdown

Summary

  • Add theme config option ("dark" or "light") to set the initial preview page theme, defaulting to "dark" for backwards compatibility
  • Previously the theme was hardcoded to "dark" in both the HTML template (data-theme) and JavaScript (currentTheme / applyTheme('dark'))
  • Uses the same __PLACEHOLDER__ + gsub pattern as bottom_padding

Changes

  • assets/index.html: Replace hardcoded data-theme="dark" with data-theme="__THEME__", read initial theme from dataset.theme in JS, and use currentTheme in boot instead of hardcoded 'dark'
  • lua/markdown_preview/init.lua: Add theme = "dark" to config, add __THEME__ gsub in write_index()
  • README.md: Document theme option in Quick start and Configuration sections

Usage

require("markdown_preview").setup({ theme = "light" })

Allow users to set the initial preview theme ("dark" or "light") via
the `theme` config option, defaulting to "dark" for backwards
compatibility. Previously the theme was hardcoded to dark in both
the HTML template and JavaScript.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant