mjbvz / vscode-github-markdown-preview-style

VS Code extension that changes the built-in markdown preview to match Github's styling
https://marketplace.visualstudio.com/items?itemName=bierner.markdown-preview-github-styles
MIT License
303 stars 57 forks source link

Add dark theme support #70

Closed ghost closed 2 years ago

ghost commented 2 years ago

Once they spoke of it in hushed tones... it is now time. Closes #65. Fixes #39.

ghost commented 2 years ago

I think it might be best to toggle the body class directly unless there's any reason to object on that?

This is not possible and the webview panel DOM is not exposed in the VSC window API.

ghost commented 2 years ago

There should probably also be a system setting to use the OS theme (as in @media (prefers-color-theme: dark)

ghost commented 2 years ago

I've looked into it and I personally think there should just be a light-only extension. The work is already done over at https://github.com/OzakIOne/markdown-github-dark/tree/ed05b28. It's a simple matter of a couple grep-seds.

If a container is injected to the Markdown preview, that might mislead people into thinking the container's part of core.

ghost commented 2 years ago

IMO, the choice of dark-only and light-only is covered. Does this resolve the review?

mjbvz commented 2 years ago

It would be a nicer if this extension could provide this functionality since it already would be shipping the light and dark GitHub color themes

Did you run into any issues with the container approach?

ghost commented 2 years ago

I don't know how to implement it

ghost commented 2 years ago

I've enabled edits by maintainers, would you like to help implement it or mark this with help-wanted?

ghost commented 2 years ago

Bumping

mjbvz commented 2 years ago

I will review PRs but don't have time atm to do lots of work fixing up incomplete ones like this

ghost commented 2 years ago

That's okay, I've made a call for help on the extension Slack in the meantime

ghost commented 2 years ago

I think it would be better to toggle the classes using a simpler script:

https://code.visualstudio.com/api/extension-guides/markdown-extension#adding-advanced-functionality-with-scripts

ghost commented 2 years ago

Does this allow support for posting worker messages like how image-preview did? For live switching of course.

ghost commented 2 years ago

Theme can be configured, what do you think? I threw in a free system setting if people want to sync with their OS theme!

ProfMoo commented 2 years ago

@SNDST00M Thanks for all the hard work on this. I can't wait to use it.

My 2 cents: Might be worth adding the config value(s) to the README or docs somewhere. Most VSCode extensions include something like

"markdown-preview-github-styles.colorMode": [ dark, light, etc.. ]

In the README.md in the root level.

ghost commented 2 years ago

Done.

ghost commented 2 years ago

@mjbvz as I'm sure Moo would concur, this pull looks ready to ship :)

mjbvz commented 2 years ago

Great work! Will publish this update shortly

mjbvz commented 2 years ago

Published in 1.0.0!

Please give it a quick test pass though. I made a few changes to the implementation and the styling. Specifically I've removed the extra container/padding that was previously around the markdown content and added back a max-width:

Screen Shot 2022-01-07 at 1 58 52 PM

ghost commented 2 years ago

I really like it, nicely done :)

junaga commented 2 years ago

Way to go guys!! thank you. I love this extension

ProfMoo commented 2 years ago

Thanks to all involved :)