Code Block Syntax Highlighting - Text

This is not really a bug actually. There are two types of blocks in Joplin:

  • Fenced code blocks, that start with ``` and that are meant to contain syntax highlighted code. If that’s code you have, you should use this.
  • Preformatted text blocks, which are indented with four spaces or a tab, and are meant to display preformatted text (same as HTML PRE tag).

The problem is when you used fenced code block when all you want is preformatted text. In that case it will try to auto-detect code, and will obviously wrongly guess since it’s not code inside.

Perhaps we could indeed add a qualifier to fenced code block that would make it behave like preformatted text block. Is “text” a standard? What does StackExchange use for example?

1 Like