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

A tabbed interface for displaying multiple code blocks. 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;
}
console.log('Tab Zed');
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
Groovygradle, groovy
Handlebarshandlebars, hbs
HTML/XMLhtml, xhtml, xml
HTTPhttp
Javajava
JavaScriptcoffeescript, ecmascript, javascript, js, node
JSONjson
Juliajl, julia
Kotlinkotlin, kt
Liquidliquid
Markdownmarkdown
Objective-Cobjc, objectivec,
Objective-C++objc++, objcpp, objectivecpp, objectivecplusplus,
OCamlocaml, ml
Perlperl, pl
PHPphp
PowerShellpowershell, ps1
Pythonpy, python
Rr
Rubyjruby, macruby, rake, rb, rbx, ruby
Rustrs, rust
Scalascala
Shellbash, sh, shell, zsh
SQLcql, mssql, mysql, plsql, postgres, postgresql, pgsql, sql, sqlite
Swiftswift
TypeScriptts, typescript
YAMLyaml, yml

Did this page help you?