text highlight in markdown

Within a Markdown editor I want to support text highlight, not in the sense of code highlighting, but the type of highlighting people do on books.

In code oriented sites people can use backquotes for a grey background, normally inline code within a paragraph. However on books there is the marker pen for normal text within a paragraph. That is the classical black text on yellow background.

Is there any syntax within Markdown (or its variants) to specify that the user want that type of highlight? I want to preserve the backquotes syntax for code related marking, but also want a way to enable highlighted user text

My first thought is just using double backquotes, since triple backquotes are reserved for code blocks. I am just wondering if other implementations have already decided a syntax for it... I would also appreciate if someone could justify if this is a very bad idea.

2

7 Answers

As the markdown documentation states, it is fine to use HTML if you need a feature that is not part of Markdown.

HTML5 supports

<mark>Marked text</mark>

Else you can use span as suggested by Rad Lexus

<span>Marked text</span>
6

I'm late to the party but it seems like a couple of markdown platforms (Quilt & iA Writer) are using a double equal to show highlighting.

==highlight==
2

Typora is also using double equal for highlighting. It would be nice it that becomes a CommonMark standard, as mentioned by DirtyF. It would be nice for those who use it frequently, since it is only 4 repeated chars: ==highlight==

If you want the option to use multiple editors, it may be best to stick with <mark>highlight</mark> for now, as answered by Matthias.

Here is the latest spec from CommonMark, "which attempts to specify Markdown syntax unambiguously". Currently "highlighting" is not included.

Editors using ==highlight== from comments mentioned previously:

  • Typora
  • Obsidian
  • Quilt
  • IA Writer

Feel free to add to this list.

1

Grey-colored Higlighting Solution

A possible solution is to use the <code> element:
This solution works really well on git/github, because git/github doesn't allow css styling.

OBS!:
Using the code-element for highlighting is not semantic.
However, it is a possible solution for adding grey-colored highlighting to text in markdown.

Markdown/HTML

<code> <i>This text will be italic</i> <b>this text will be bold</b> </code>

Output

This text will be italic this text will be bold

Roam markdown uses double-caret: ^^highlight^^. Andrew Shell's answer mentions double-equals.

The accepted and clearly correct answer is <mark> from Matthias above, but I thought I had seen carets in some other flavor of markdown. Maybe not. I want to transform my ^^highlights^^ to <mark>highlights</mark> in pandoc conversion to html, and somehow ended up here...

You can use the Grave accent (backtick) ` to highlight text in markdown

Highlighted text

Also works with VS Code extension markdownlint

Probably best bet is just use html e.g

<pre><b>Hello</b> is higlighted</pre>
Hello is higlighted

Remember nearly all html is valid in markdown too.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like