vsch / idea-multimarkdown

Markdown language support for IntelliJ IDEA.
https://plugins.jetbrains.com/plugin/7896-markdown-navigator
Apache License 2.0
813 stars 129 forks source link

Non-monospaced font for code block in Swing preview browser #790

Closed breandan closed 4 years ago

breandan commented 4 years ago

By default, the Swing preview browser uses a proportional font instead of a monospaced font for rendering code blocks:

Screen Shot 2019-11-22 at 1 00 36 AM

vsch commented 4 years ago

@breandan, it does but the provided list of common font families not have any installed on a given system.

Here are the default font definitions for Swing browser. You can override it in Languages & Frameworks > Markdown > Stylesheet, by adding custom CSS Text. The first is the default monospaced font definitions:

code,
span.code,
samp,
var,
span.var,
kbd,
span.kbd,
span.tt {
    font-family: Consolas, Inconsolata, "Liberation Mono", Menlo, Courier, Monospaced, monospace;
    font-size: 1em;
}

You may want to experiment with the list by moving a font family up in the list or if you know the installed font you want to use just add it at the beginning of the list.

And the proportional definition if you want to change the default font on your system:

/* NOTE: all other font sizes are set relative to font size given here and this is overridden in the CssProvider */
body.multimarkdown-preview,
body.multimarkdown-wiki-preview {
    background-color: white;
    font-family: "Helvetica Neue", Helvetica, Arial, freesans, sans-serif;
    font-size: 11px;
    padding: 20px;
}