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:
go
CopyEdit
```language // your code here ```
Replace
language
with one supported by Highlight.js.If no language is specified, the system will try to detect it automatically.
To disable highlighting, use
nohighlight
as the language.
Examples
JavaScript
javascript
CopyEdit
var el = document.getElementById('content');
PHP
php
CopyEdit
$var = array_keys(['key' => 'value']);
Ruby
ruby
CopyEdit
puts 'Hello World'
Bash
bash
CopyEdit
export variable="value";