facelessuser / MarkdownPreview

Markdown preview and build plugin for Sublime Text https://facelessuser.github.io/MarkdownPreview/
Other
405 stars 53 forks source link

Black code block #165

Closed ape660 closed 1 year ago

ape660 commented 1 year ago

Is it possible to change a block of code to a black background ? Like 图片 How do I set it up?

facelessuser commented 1 year ago

I'm assuming you are using the Python Markdown parser option, so you'd have to configure the Pygments options: https://facelessuser.github.io/MarkdownPreview/usage/?h=pygments#configuring-pygments.

ape660 commented 1 year ago

I am using the Python Markdown parser. I try to set pygments_style to a dark style provided by pygments. But no html file generate. I try one-dark, solarized-dark, github-dark and so on. No html generate! I cant change the code block style into dark. my setting

        {
             "pymdownx.highlight": {
                "noclasses": true,
                "linenums": true,
                "pygments_style": "github-dark"

            }
        },

I got styles provided by Pygments

from pygments.styles import STYLE_MAP
STYLE_MAP.keys()

the output

dict_keys(['default', 'emacs', 'friendly', 'friendly_grayscale', 'colorful', 'autumn', 'murphy', 'manni', 'material', 'monokai', 'perldoc', 'pastie', 'borland', 'trac', 'native', 'fruity', 'bw', 'vim', 'vs', 'tango', 'rrt', 'xcode', 'igor', 'paraiso-light', 'paraiso-dark', 'lovelace', 'algol', 'algol_nu', 'arduino', 'rainbow_dash', 'abap', 'solarized-dark', 'solarized-light', 'sas', 'staroffice', 'stata', 'stata-light', 'stata-dark', 'inkpot', 'zenburn', 'gruvbox-dark', 'gruvbox-light', 'dracula', 'one-dark', 'lilypond', 'nord', 'nord-darker', 'github-dark'])

But most dark themes are not effective(no html output).

Did I do something wrong? I think i need more tips.

facelessuser commented 1 year ago

github-dark is not installed within the Python inside Sublime Text. If you are talking about your external Python, that isn't used. With that said, I will have to look into changing code colors as I think there may have been some regressions regarding this. While you can select a different color scheme, there seems to be a conflict with default CSS backgrounds and Pygments themes.

ape660 commented 1 year ago

Thank you! you are too kind.

facelessuser commented 1 year ago

Generally, things will be working better in the next version. If you require additional styling tweaks, you may have to use your own overrides via https://facelessuser.github.io/MarkdownPreview/usage/#including-css.