You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mkbook/docs-src/02-markdown/02-syntax-highlighting.md

3.9 KiB

title = "Syntax Highlighting"title = "Syntax Highlighting"

Syntax Highlighting

GFM syntax highlighting is also available by using fenced code tags with a label denoting the language, as such:

```c++
#include <stdio>

int main() {
    std::cout << "Hello, world!" << std::endl;
    return 0;
}
```

which results in:

#include <stdio>

int main() {
    std::cout << "Hello, world!" << std::endl;
    return 0;
}

To denote the language you can either use one the language's extensions as the label, or the full name of the language (which is not case-sensitive).

The list of supported languages is currently as follows:

ASP

asa

ActionScript

as

AppleScript

applescript, script editor

Batch File

bat, cmd

BibTeX

bib

Bourne Again Shell (bash)

sh, bash, zsh, fish, .bash_aliases, .bash_completions, .bash_functions, .bash_login, .bash_logout, .bash_profile, .bash_variables, .bashrc, .profile, .textmate_init

C

c, h

C#

cs, csx

C++

cpp, cc, cp, cxx, c++, C, h, hh, hpp, hxx, h++, inl, ipp

CSS

css, css.erb, css.liquid

Cargo Build Results

``

Clojure

clj

D

d, di

Diff

diff, patch

Erlang

erl, hrl, Emakefile, emakefile

Go

go

Graphviz (DOT)

dot, DOT, gv

Groovy

groovy, gvy, gradle

HTML

html, htm, shtml, xhtml, inc, tmpl, tpl

HTML (ASP)

asp

HTML (Erlang)

yaws

HTML (Rails)

rails, rhtml, erb, html.erb

HTML (Tcl)

adp

Haskell

hs

Haxe

hx, hxsl, hscript

Hxml

hxml

JSON

json, sublime-settings, sublime-menu, sublime-keymap, sublime-mousemap, sublime-theme, sublime-build, sublime-project, sublime-completions, sublime-commands, sublime-macro, sublime-color-scheme

Java

java, bsh

Java Properties

properties

Java Server Page (JSP)

jsp

JavaDoc

``

JavaScript

js, htc

JavaScript (Rails)

js.erb

LaTeX

tex, ltx

LaTeX Log

``

Lisp

lisp, cl, clisp, l, mud, el, scm, ss, lsp, fasl

Literate Haskell

lhs

Lua

lua

MATLAB

matlab

Make Output

``

Makefile

make, GNUmakefile, makefile, Makefile, OCamlMakefile, mak, mk

Markdown

md, mdown, markdown, markdn

MultiMarkdown

``

NAnt Build File

build

OCaml

ml, mli

OCamllex

mll

OCamlyacc

mly

Objective-C

m, h

Objective-C++

mm, M, h

PHP

php, php3, php4, php5, php7, phps, phpt, phtml

PHP Source

``

Pascal

pas, p, dpr

Perl

pl, pm, pod, t, PL

Plain Text

txt

Python

py, py3, pyw, pyi, pyx, pyx.in, pxd, pxd.in, pxi, pxi.in, rpy, cpy, SConstruct, Sconstruct, sconstruct, SConscript, gyp, gypi, Snakefile, wscript

R

R, r, s, S, Rprofile

R Console

``

Rd (R Documentation)

rd

Regular Expression

re

Regular Expressions (Javascript)

``

Regular Expressions (Python)

``

Ruby

rb, Appfile, Appraisals, Berksfile, Brewfile, capfile, cgi, Cheffile, config.ru, Deliverfile, Fastfile, fcgi, Gemfile, gemspec, Guardfile, irbrc, jbuilder, podspec, prawn, rabl, rake, Rakefile, Rantfile, rbx, rjs, ruby.rail, Scanfile, simplecov, Snapfile, thor, Thorfile, Vagrantfile

Ruby Haml

haml, sass

Ruby on Rails

rxml, builder

Rust

rs

SCSS

scss

SQL

sql, ddl, dml

SQL (Rails)

erbsql, sql.erb

Sass

sass

Scala

scala, sbt

Shell-Unix-Generic

``

TOML

toml, tml, Cargo.lock, Gopkg.lock, Pipfile

Tcl

tcl

TeX

sty, cls

Textile

textile

XML

xml, xsd, xslt, tld, dtml, rss, opml, svg

YAML

yaml, yml, sublime-syntax

camlp4

``

commands-builtin-shell-bash

``

reStructuredText

rst, rest