How can I highlight markdown formatting (bold/italics etc.) with different colours?
What are you trying to do?
Just pass the first section if you move right into the question I have.
My Workflow
I really really like this app, but unfortunately I couldn't manage to handle this issue that I've been facing for a few days. It's really important for me because my note-taking workflow is based on these coloured formatting. Let me explain my workflow shortly before move on as some of you find it useful.
- While I'm taking notes, emphasizing is crucial to check the old notes, especially for skimming and scanning.
- I use bold for the important keywords, and italics for the important phases or sentences that I want to see later on.
- As natively markdown doesn't support underline or highlighting, these play crucial role the emphasize what I want.
- I also want my individual markdown files readable with different apps, so the former one is important.
So, the issue I have
- I want to colour the markdown formatting (like bold, italics and ~~strikethrough~~), but couldn't find any way to do it. Are there any workarounds?
- A new section to add custom CSS files would be great in the upcoming updates.
What have you tried?
- I've tried different themes as copying different VS Code themes, but none of them work as I want.
- They just colour the headings, and some of them colour parenthesis as well, but nothing for bold/italics.
- I've also searched a bit, and found out that it's something about usage area of those themes (they don't work well for markdown syntax), but I'm not sure as this answer is from AI.
Platform and app version
Windows 10 - v2.7.4
Your guess was right, and it wasn't your themes' fault.
A VS Code theme colours TextMate scopes — markup.bold, markup.italic. Monaco, the editor Markpad uses, tokenizes markdown under names of its own: strong, emphasis, variable for inline code, string.link. Markpad was passing your theme's scopes through unchanged, so every emphasis rule landed on a token name that nothing emits and coloured nothing, silently. Headings and lists came through only because they happen to tokenize as keyword, which themes define under that exact name too — that coincidence is why it looked like themes could only reach headings.
#678 renames the four that Monaco can receive: bold, italic, inline code and links. With that in, a theme defining markup.bold / markup.italic (or the language-qualified markup.bold.markdown) colours those spans in the editor, and the bold and italic rendering stays on top of the colour. It'll be in the next release; until then there's no workaround, since nothing about it was configurable.
Two things it won't cover:
Strikethrough is not reachable. Monaco's markdown tokenizer doesn't recognise ~~text~~ at all, so there is no token for a theme rule to attach to. Same for ==highlight== and ++insert++. Colouring those in the editor means Markpad shipping its own copy of the grammar — worth doing, but it's a separate piece of work.
Highlighting, though, you already have in the preview. ==text== renders as a highlight, and Settings → Highlight Color offers nine colours for it; ++text++ renders underlined. Both are extensions rather than plain CommonMark, so other apps' support varies — but since you mentioned markdown having no native underline or highlight, they may fit your note-taking better than reusing bold and italic for it.
Your other ask — a place to drop in custom CSS — is a real request but a different feature; please open it separately so it doesn't get lost behind this one.
Following up, because the part I said was out of reach is now in.
What I wrote last time was that ~~strikethrough~~, ==highlight== and ++insert++ had no token for a theme rule to attach to, since Monaco's Markdown tokenizer does not recognise them, and that reaching them meant Markpad owning a copy of the grammar. It turned out there was a better answer than a fork: the editor now asks the renderer. #686 has it read its colours from the same comrak parse the preview is built from, so anything the preview renders is something the editor can colour — and the rule behind the colours becomes exact: if it is coloured, it renders.
For your workflow, with your own imported theme:
| your theme's scope | now colours, in the editor |
|---|---|
markup.bold |
**bold** |
markup.italic |
*italic* |
markup.strikethrough |
~~strikethrough~~ — this is the one that could not be done before |
markup.heading |
# Heading |
markup.inline.raw |
`inline code` |
markup.underline.link |
[link](url) |
markup.quote |
> quote |
markup.list |
- and 1. |
markup.fenced_code |
the ``` lines |
meta.separator |
--- |
The language-qualified spellings (markup.bold.markdown and so on) work the same way, and the markup characters take the colour along with the words they are about — the two ~~ and the struck word, the # and its title.
Two things your theme still cannot reach, and one of them is by construction:
==highlight== and ++insert++ take Markpad's own colours, not yours. There is no TextMate scope for either — they are not CommonMark, so no VS Code theme has ever had a name for them. They are coloured in the editor now, amber and amber-underlined, but a theme has nothing to say about them. The same goes for wikilinks, maths, footnotes, task checkboxes and tables.
Two other things you may notice. snake_case_word no longer comes out italic — Monaco's grammar matched its emphasis rule there and CommonMark renders no emphasis inside a word, so the parse says no. And a - [x] checkbox is no longer purple; the grammar read the brackets as a link.
None of this is in a release yet; it is on master and will be in the next one. Your other ask, a place to drop in custom CSS, is still a separate feature — please do open it on its own so it does not get lost behind this issue.