Code Blocks

Examples

Tabbed Code Blocks

console.log('Code Tab A');
console.log('Code Tab B');

Single Code Block

console.log('a code block');

Syntax

We offer both classic single code blocks, as well as a tabbed interface for displaying multiple code blocks concisely! These are written nearly identically to a series of vanilla markdown code snippets, except for their distinct lack of an additional line break separating each subsequent block:

```javascript I'm A tab
console.log('Code Tab A');
```
```javascript I'm tab B
console.log('Code Tab B');
```

Custom CSS

.markdown-body {
  --md-code-background: #e3dcef;
  --md-code-text: #4a2b7b;
  --md-code-tabs: #c6b8dd;
  --md-code-radius: 4px;
}
```js Tab 0 console.log('Tab Zed'); ``` ```js Tab 1 console.log('Tab One'); ```

Language Support

We support syntax highlighting on a number of languages:

LanguageAvailable language mode(s)
ASP.NETasp, aspx
Cc
C++c++, cpp, cplusplus
C#cs, csharp
Clojureclj, cljc, cljx, clojure
CSScss, less, sass, scss, styl, stylus
cURLcurl
Dd
Dartdart
Diffdiff
Dockerdockerfile
Erlangerl, erlang
Gogo
GraphQLgql, graphql
Groovygradle, groovy
Handlebarshandlebars, hbs
HTML/XMLhtml, xhtml, xml
HTTPhttp
Javajava
JavaScriptcoffeescript, ecmascript, javascript, js, node
JSXjsx
JSONjson
Juliajl, julia
Kotlinkotlin, kt
Liquidliquid
Lualua
Markdownmarkdown
Mermaidmermaid
Objective-Cobjc, objectivec,
Objective-C++objc++, objcpp, objectivecpp, objectivecplusplus,
OCamlocaml, ml
Perlperl, pl
PHPphp
PowerShellpowershell, ps1
Pythonpy, python
Rr
Reactjsx
Rubyjruby, macruby, rake, rb, rbx, ruby
Rustrs, rust
Scalascala
Shellbash, sh, shell, zsh
Soliditysol, solidity
SQLcql, mssql, mysql, plsql, postgres, postgresql, pgsql, sql, sqlite
Swiftswift
TypeScriptts, typescript
YAMLyaml, yml