You can copy the code directly from the Note View page, or from the split editing mode.
Move your mouse to the code block and the copy button will appear in the upper right corner.
Input ```
followed by a new line, paste your code, and also insert another new line followed by ```
at the end.
HackMD supports a wide range of syntaxes such as JavaScript, CSS, HTML, and more.
To specify a syntax, type its name followed by an equals sign (=), then paste your code on the next line.
It will show:
To display line numbers when viewing code, append =
after the programming language type.
You can also specify the starting line number for code blocks by entering = 101
after it; the line numbers will start from 101:
Result:
You can also continue the line numbering from the previous code block by entering =+
.
Hint
Simply input ``
and insert characters between them to create an inline Code Block!
Example: console.log()