Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Conversation

@kLiHz
Copy link

@kLiHz kLiHz commented May 2, 2024

This PR is based on #129. If #129 should be merged, this branch is supposed to be rebased on it.

I add some dark theme support (automatically reads user's preference, and without a manual toggle switch), possibly solves #114.

I noticed that the CSS for highlighted code blocks was from gfm module. So I think I should continue to use gfm for code blocks under dark theme, and it does have dark theme support.

Syntax highlights were successful since colors applied to both .markdown-body .highlight .token.keyword and .gfm-highlight .token.keyword and our code block matches the later one.

However gfm's dark theme overrides for color variables fails unless we add

data-color-mode="auto"
data-light-theme="light"
data-dark-theme="dark"

to the element. And since syntax highlighting's default color only applies to .markdown-body .highlight pre and .markdown-body pre, which means if we'd like to reuse gfm's CSS rules without modifying gfm itself, the code block needs to be a child of .markdown-body.

However being a child of .markdown-body brings in some other CSS rules. I override its padding and background-color using inline style attribute, which fix things a little, but other rules the font-size, line-height and overflow set by text-sm and sm:overflow-hidden was also overridden by rules for .markdown-body in gfm.css. Luckily, these changes seems to be subtle.

@kt3k
Copy link
Member

kt3k commented May 17, 2024

We moved denobyexamples to https://docs.deno.com/examples ( https://github.com/denoland/deno-docs/tree/main/by-example ), and the dark mode is supported there.

Thanks for your contribution anyways

@kt3k kt3k closed this May 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants