sparksuite / simplemde-markdown-editor

A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://simplemde.com
MIT License
9.86k stars 1.13k forks source link

Code block formatting in edit view #546

Open justinkelly opened 7 years ago

justinkelly commented 7 years ago

When using the ``` code blocks

What I expect

What happens

Thanks for all your great work on this amazing project!!

bennett-jacob commented 6 years ago

Just to clarify, you mean applying the page css for the code tag to the code block in the editor, right? Which in most browsers and css styles means the font is monospaced, and in some cases (like yours) the entire block has a colored background.

soraphis commented 6 years ago

well, i would find it cool to have the code-text in the editor view in monospace, like with this rule:

.cm-comment {
    font-family: Monospace;
}

to get the full block background:

.cm-comment:first-child:last-child {
    width: 95%; /* don't 100%, you need space for the four whitespaces if indentation is used */
    display: inline-block;
    line-height: 1.7;
}

.cm-comment {
    font-family: monospace;
}

for further more improvements one would need to dig into the javascript... its 2am i'm to tired for this now