Fenced Code Blocks




Introducing Fenced Code Blocks

A block of source code can be added directly to any slide within your PITCHME.md using triple back-ticks markdown syntax. For a detailed description of this triple back-ticks syntax, see the GitHub Fenced Code Blocks guide. To learn by example, keep reading this guide for demo usage.


Simple FCB Slide Example

This PITCHME.md sample markdown snippet uses an elixir code language hint:


    ---

    @snap[north span-100]
    #### Fenced Code Block
    @snapend

    ```elixir
    defmodule GenMetrics.GenStage.Monitor do
        use GenServer

        alias GenMetrics.GenStage.Manager
        alias GenMetrics.GenStage.Monitor
        alias GenMetrics.GenStage.Pipeline
        alias GenMetrics.GenStage.Window
        alias GenMetrics.Reporter
        alias GenMetrics.Utils.Runtime

        @moduledoc false
        @handle_demand :handle_demand
        @handle_events :handle_events
        @handle_call   :handle_call
        @handle_cast   :handle_cast

        defstruct pipeline: %Pipeline{}, metrics: nil, start: 0, duration: 0
    ```

Results in the rendering of the following slide:

CODE-FCB-SIMPLE

See the Code Highlighting Guide to learn how you can control the highlighting style and background color of your code slides.


Snap Layouts FCB Example

This PITCHME.md sample markdown snippet uses elixir code language hints and snap-layouts syntax:


    ---

    @snap[east span-50]
    ### Fenced Code within<br>Snap Layouts
    @snapend

    @snap[north-west span-55]
    #### Module Aliases
    ```elixir
    alias GenMetrics.GenStage.Manager
    alias GenMetrics.GenStage.Monitor
    alias GenMetrics.GenStage.Pipeline
    alias GenMetrics.Reporter
    alias GenMetrics.GenStage.Window
    alias GenMetrics.Utils.Runtime
    ```
    @snapend

    @snap[south-west span-55]
    #### Module Attributes
    ```elixir
    @moduledoc false
    @handle_demand :handle_demand
    @handle_events :handle_events
    @handle_call   :handle_call
    @handle_cast   :handle_cast
    ```
    @snapend

Results in the rendering of the following slide:

CODE-FCB-SNAP-LAYOUTS

See the Code Highlighting Guide to learn how you can control the highlighting style and background color of your code slides.


Pro Code Zoom FCB Example

This PITCHME.md sample markdown snippet uses an sql code language hint:


    ---

    @snap[north span-100]
    #### Fenced Code Block with Pro Code Zoom
    @snapend

    ```sql zoom-20   
    CREATE TABLE "topic" (
        "id" serial NOT NULL PRIMARY KEY,
        "forum_id" integer NOT NULL,
        "subject" varchar(255) NOT NULL
    );                              
    ALTER TABLE "topic"      
    ADD CONSTRAINT forum_id       
    FOREIGN KEY ("forum_id")
    REFERENCES "forum" ("id");
    ```

Results in the rendering of the following slide:

CODE-FCB-PRO-ZOOM

This sample slide provides a quick introduction to Code ZOOM. To learn about the full set of Code ZOOM features see the Pro Code Zoom Guide.


The Importance of Code Language Hints

Source code can be added to any slide using a number of different techniques. And once code has been added to a slide, it enjoys automatic syntax highlighting. But automatic syntax highlighting is best-effort only.

The use of an explicit code language hint is strongly recommended for the following reasons:

  1. Language hints ensure the code is rendered using the most appropriate highlighting style.
  2. Language hints also ensures that any markup in your code is properly escaped before being rendered as slide content in the browser.

Language hints are especially important when presenting code snippets containing markup syntax, for example: HTML, XML, PHP, React snippets etc.

See the Code Language Hints Quick Reference Table to find an alias that can be used as a language hint when displaying code on your slides.


Code Language Hints Quick Reference Table

The following table lists the supported languages and their corresponding aliases. You should use these aliases as the language hint anytime you are injecting code on your slides.


Language Aliases
1C 1c
ABNF abnf
Access logs accesslog
Ada ada
ARM assembler armasm, arm
AVR assembler avrasm
ActionScript actionscript, as
Alan alan, i
AngelScript angelscript, asc
Apache apache, apacheconf
AppleScript applescript, osascript
Arcade arcade
AsciiDoc asciidoc, adoc
AspectJ aspectj
AutoHotkey autohotkey
AutoIt autoit
Awk awk, mawk, nawk, gawk
Axapta axapta
Bash bash, sh, zsh
Basic basic
BNF bnf
Brainfuck brainfuck, bf
C# cs, csharp
C++ cpp, c, cc, h, c++, h++, hpp
C/AL cal
Cache Object Script cos, cls
CMake cmake, cmake.in
Coq coq
CSP csp
CSS css
Cap’n Proto capnproto, capnp
Clojure clojure, clj
CoffeeScript coffeescript, coffee, cson, iced
Crmsh crmsh, crm, pcmk
Crystal crystal, cr
Cypher (Neo4j) cypher
D d
DNS Zone file dns, zone, bind
DOS dos, bat, cmd
Dart dart
Delphi delphi, dpr, dfm, pas, pascal, freepascal, lazarus, lpr, lfm
Diff diff, patch
Django django, jinja
Dockerfile dockerfile, docker
dsconfig dsconfig
DTS (Device Tree) dts
Dust dust, dst
Dylan dylan
EBNF ebnf
Elixir elixir
Elm elm
Erlang erlang, erl
Excel excel, xls, xlsx
Extempore extempore, xtlang, xtm
F# fsharp, fs
FIX fix
Fortran fortran, f90, f95
G-Code gcode, nc
Gams gams, gms
GAUSS gauss, gss
GDScript godot, gdscript
Gherkin gherkin
GN for Ninja gn, gni
Go go, golang
Golo golo, gololang
Gradle gradle
Groovy groovy
HTML, XML xml, html, xhtml, rss, atom, xjb, xsd, xsl, plist
HTTP http, https
Haml haml
Handlebars handlebars, hbs, html.hbs, html.handlebars
Haskell haskell, hs
Haxe haxe, hx
Hy hy, hylang
Ini, TOML ini, toml
Inform7 inform7, i7
IRPF90 irpf90
JSON json
Java java, jsp
JavaScript javascript, js, jsx
Kotlin kotlin, kt
Leaf leaf
Lasso lasso, ls, lassoscript
Less less
LDIF ldif
Lisp lisp
LiveCode Server livecodeserver
LiveScript livescript, ls
Lua lua
Makefile makefile, mk, mak
Markdown markdown, md, mkdown, mkd
Mathematica mathematica, mma, wl
Matlab matlab
Maxima maxima
Maya Embedded Language mel
Mercury mercury
mIRC Scripting Language mirc, mrc
Mizar mizar
Mojolicious mojolicious
Monkey monkey
Moonscript moonscript, moon
N1QL n1ql
NSIS nsis
Nginx nginx, nginxconf
Nimrod nimrod, nim
Nix nix
OCaml ocaml, ml
Objective C objectivec, mm, objc, obj-c
OpenGL Shading Language glsl
OpenSCAD openscad, scad
Oracle Rules Language ruleslanguage
Oxygene oxygene
PF pf, pf.conf
PHP php, php3, php4, php5, php6
Parser3 parser3
Perl perl, pl, pm
Plaintext: no highlight plaintext
Pony pony
PostgreSQL & PL/pgSQL pgsql, postgres, postgresql
PowerShell powershell, ps
Processing processing
Prolog prolog
Properties properties
Protocol Buffers protobuf
Puppet puppet, pp
Python python, py, gyp
Python profiler results profile
Q k, kdb
QML qml
R r
Razor CSHTML cshtml, razor, razor-cshtml
ReasonML reasonml, re
RenderMan RIB rib
RenderMan RSL rsl
Roboconf graph, instances
Robot Framework robot, rf
RPM spec files rpm-specfile, rpm, spec, rpm-spec, specfile
Ruby ruby, rb, gemspec, podspec, thor, irb
Rust rust, rs
SAS SAS, sas
SCSS scss
SQL sql
STEP Part 21 p21, step, stp
Scala scala
Scheme scheme
Scilab scilab, sci
Shape Expressions shexc
Shell shell, console
Smali smali
Smalltalk smalltalk, st
Solidity solidity, sol
Stan stan
Stata stata
Structured Text iecst, scl, stl, structured-text
Stylus stylus, styl
SubUnit subunit
Supercollider supercollider, sc
Swift swift
Tcl tcl, tk
Terraform (HCL) terraform, tf, hcl
Test Anything Protocol tap
TeX tex
Thrift thrift
TP tp
Twig twig, craftcms
TypeScript typescript, ts
VB.Net vbnet, vb
VBScript vbscript, vbs
VHDL vhdl
Vala vala
Verilog verilog, v
Vim Script vim
x86 Assembly x86asm
XL xl, tao
XQuery xquery, xpath, xq
YAML yml, yaml
Zephir zephir, zep

This language alias table was last updated in late August, 2019.