Search code examples
mermaid

Mermaid how to use inline code syntax highlighting


Here is a Mermaid flowchart (link):

flowchart TD
    A["`How to highlight SomeClass with code syntax?`"]

I am looking for it to display like this:

How to highlight SomeClass with code syntax?

How can one get inline code highlighting syntax?


Solution

  • Using the html code element along with some inline styling results in what you asked for:

    flowchart TD
        A["How to highlight <code style='padding: 4px; border-radius: 8px; background-color: #E3E6E8'>SomeClass</code> with code syntax?"]
    

    PS: The backticks you wrapped the whole string in have to be removed in order for this to work.