Code Formatting with Syntax Highlighting
You can easily showcase code snippets inside your articles using syntax highlighting. If you're using the Markdown Editor, just use triple backticks (```) to wrap your code blocks and optionally specify the language.
If youโre using the WYSIWYG Editor, make sure to wrap code inside <pre><code> tags manually.
How to Use
To format code:
goCopyEdit
```language // your code here ```
Replace
languagewith one supported by Highlight.js.If no language is specified, the system will try to detect it automatically.
To disable highlighting, use
nohighlightas the language.
Examples
JavaScript
javascriptCopyEdit
var el = document.getElementById('content');
PHP
phpCopyEdit
$var = array_keys(['key' => 'value']);
Ruby
rubyCopyEdit
puts 'Hello World'
Bash
bashCopyEdit
export variable="value";