Code block and Mermaid diagram improvements

Code block numbering

You can now add line numbering to code blocks. This is opt-in and can be done by adding a custom property to the code block, by adding linenums=1 after the code language, e.g.

```js linenums=1
**CODE HERE**

Mermaid diagrams

Mermaid is a flexible JavaScript-driven diagramming framework. It allows you to use custom markdown syntax in a code block which gets converted on-the-fly to a diagram. We have integrated Mermaid into Discourse, so code blocks that have the language mermaid will be converted.

Note: As with other syntax-driven diagramming frameworks, Mermaid syntax is easy to get wrong. It is recommended that you test your syntax first on mermaid.live to ensure it’s correct. The first line should be the diagram type and indentations are needed using 4 spaces.

It is also important to note that the component currently uses Mermaid version 10.4.1. Mermaid is constantly evolving, so it’s important to double-check the documentation to ensure the diagram and syntax you’re using is supported by this version.

3 Likes

testing

let i=0;
i=1;
1 Like