Makeup Demo

Elixir Language

The Elixir lexers contains three demos: a sandbox which shows most of the syntax, an example of recognizing (possibly nested) matching delimiters and an example of an IEx session. The same lexer is used for "normal" elixir code and for an IEx session.

This page shows examples of source files lexed by the same lexer, but rendered into HTML using different styles.

Some styles are richer than others in that they define more different token categories. Examples of such richer styles are the Default style, the Tango style and the Colorful style.

In all cases the lexer is the same, and the only difference is the colors defined by the styles.

Abap Style (abap)

You can access this style as:

Makeup.Styles.HTML.StyleMap.abap_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Algol Style (algol)

You can access this style as:

Makeup.Styles.HTML.StyleMap.algol_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Algol_Nu Style (algol_nu)

You can access this style as:

Makeup.Styles.HTML.StyleMap.algol_nu_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Arduino Style (arduino)

You can access this style as:

Makeup.Styles.HTML.StyleMap.arduino_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Autumn Style (autumn)

You can access this style as:

Makeup.Styles.HTML.StyleMap.autumn_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Borland Style (borland)

You can access this style as:

Makeup.Styles.HTML.StyleMap.borland_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

BlackWhite Style (bw)

You can access this style as:

Makeup.Styles.HTML.StyleMap.bw_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Colorful Style (colorful)

You can access this style as:

Makeup.Styles.HTML.StyleMap.colorful_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Default Style (default)

You can access this style as:

Makeup.Styles.HTML.StyleMap.default_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Emacs Style (emacs)

You can access this style as:

Makeup.Styles.HTML.StyleMap.emacs_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Friendly Style (friendly)

You can access this style as:

Makeup.Styles.HTML.StyleMap.friendly_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Fruity Style (fruity)

You can access this style as:

Makeup.Styles.HTML.StyleMap.fruity_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Igor Style (igor)

You can access this style as:

Makeup.Styles.HTML.StyleMap.igor_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Lovelace Style (lovelace)

You can access this style as:

Makeup.Styles.HTML.StyleMap.lovelace_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Manni Style (manni)

You can access this style as:

Makeup.Styles.HTML.StyleMap.manni_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Monokai Style (monokai)

You can access this style as:

Makeup.Styles.HTML.StyleMap.monokai_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Murphy Style (murphy)

You can access this style as:

Makeup.Styles.HTML.StyleMap.murphy_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Native Style (native)

You can access this style as:

Makeup.Styles.HTML.StyleMap.native_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

ParaisoDark Style (paraiso_dark)

You can access this style as:

Makeup.Styles.HTML.StyleMap.paraiso_dark_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

ParaisoLight Style (paraiso_light)

You can access this style as:

Makeup.Styles.HTML.StyleMap.paraiso_light_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Pastie Style (pastie)

You can access this style as:

Makeup.Styles.HTML.StyleMap.pastie_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Perldoc Style (perldoc)

You can access this style as:

Makeup.Styles.HTML.StyleMap.perldoc_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

RainbowDash Style (rainbow_dash)

You can access this style as:

Makeup.Styles.HTML.StyleMap.rainbow_dash_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Rrt Style (rrt)

You can access this style as:

Makeup.Styles.HTML.StyleMap.rrt_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Tango Style (tango)

You can access this style as:

Makeup.Styles.HTML.StyleMap.tango_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Trac Style (trac)

You can access this style as:

Makeup.Styles.HTML.StyleMap.trac_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Vim Style (vim)

You can access this style as:

Makeup.Styles.HTML.StyleMap.vim_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

VisualStudio Style (vs)

You can access this style as:

Makeup.Styles.HTML.StyleMap.vs_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"

Xcode Style (xcode)

You can access this style as:

Makeup.Styles.HTML.StyleMap.xcode_style()

And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you.

iex.exs

# Normal IEx session
iex> 1+2
3

iex> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

# Same as above, but with numbers:
iex(1)> 1+2
3

iex(2)> 1/0
** (ArithmeticError) bad argument in arithmetic expression
    :erlang./(1, 0)


iex(3)> changeset = User.changeset(%User{}, %{})
#Ecto.Changeset<action: nil, changes: %{},
  errors: [name: {"can't be blank", [validation: :required]},
   email: {"can't be blank", [validation: :required]},
   bio: {"can't be blank", [validation: :required]}],
  data: #Hello.User<>, valid?: false>

nesting.exs

defmodule MyModule do
  @moduledoc """
  This is documentation for the module
  """
  
  @doc """
  This is documentation for the function
  """
  def f(x, y, z) do
    # Place the cursor over the delimiters (...), [...], etc.
    list = [x, y, z]
    tuple = {x, y, z}
    map = %{"x" => x, "y" => y, "z" => z}
    struct = %Long.Module.Name{x: x, y: y, z: y}
    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    # Nested delimiters work too:
    nested = %{
      a: [x, y, z],
      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
      c: %Long.Module.Name{
        x: x,
        y: y,
        z: << a::size(x), b::size(y) >>
      }
    }
  end
  # That's all, folks!

  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
  # Maybe a little makeup can help you?
  # Place the cursor over the block keywords: do, else, catch, rescue after, end
  def g() do
    IO.inspect do
      "a"
    else
      IO.inspect do
        fn x -> x + 2 end # yes, it works on fn ... end too!
      else
        "b"
      catch
        if c do
          x
        else
          case y do
            1 -> if a do
                   b
                 else
                   c
                 end
            _ -> "Wow, we're deep now!"
          end
        end
      rescue
        "d"
      after
        "e"
      end
      "b"
    after
      "e"
    end
  end
end

sandbox.exs

# Numbers
0b0101011
1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
3.14 ; 5.0e21 ; 0.5e-12
100_000_000

# these are not valid numbers
0b012 ; 0xboar ; 0o888
0B01 ; 0XAF ; 0O123

# Characters
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
?\x{12} ; ?\x{abcd}
?\x34 ; ?\xF

# these show that only the first digit is part of the character
?\123 ; ?\12 ; ?\7

# Atoms
:this ; :that
:'complex atom'
:"with' \"\" 'quotes"
:" multi
 line ' \s \123 \xff
atom"
:... ; :<<>> ; :%{} ; :% ; :{}
:++; :--; :*; :~~~; :::
:% ; :. ; :<-

# Strings
"Hello world"
"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes"
"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end"
"Multiline
   string"

# Char lists
'this is a list'
'escapes \' \t \\\''
'Multiline
    char
  list
'

# Binaries
<<1, 2, 3>>
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1"

# Sigils
~r/this + i\s "a" regex/
~R'this + i\s "a" regex too'
~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s
~W(hello #{no "123" \c\d \123 interpol} world)s

~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here }

~S"No escapes \s\t\n and no #{interpolation}"

:"atoms work #{"to" <> "o"}"

# Operators
x = 1 + 2.0 * 3
y = true and false; z = false or true
... = 144
... == !x && y || z
"hello" |> String.upcase |> String.downcase()
{^z, a} = {true, x}

# Free operators (added in 1.0.0)
p  ~>> f  = bind(p, f)
p1 ~>  p2 = pair_right(p1, p2)
p1 <~  p2 = pair_left(p1, p2)
p1 <~> p2 = pair_both(p1, p2)
p  |~> f  = map(p, f)
p1 <|> p2 = either(p1, p2)

# Lists, tuples, maps, keywords
[1, :a, 'hello'] ++ [2, 3]
[:head | [?t, ?a, ?i, ?l]]

{:one, 2.0, "three"}

[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"]
["this is an atom too": 1, "so is this": 2]
[option: "value", key: :word]
[++: "operator", ~~~: :&&&]

map = %{shortcut: "syntax"}
%{map | "update" => "me"}
%{ 12 => 13, :weird => ['thing'] }

# Comprehensions
for x <- 1..10, x < 5, do: {x, x}
pixels = "12345678"
for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do
  [r, {g, %{"b" => a}}]
end

# String interpolation
"String #{inspect "interpolation"} is quite #{1+4+7} difficult"

# Identifiers
abc_123 = 1
_018OP = 2
A__0 == 3

# Modules
defmodule Long.Module.Name do
  @moduledoc "Simple module docstring"

  @doc """
  Multiline docstring
  "with quotes"
  and #{ inspect %{"interpolation" => "in" <> "action"} }
  now with #{ {:a, 'tuple'} }
  and #{ inspect {
      :tuple,
      %{ with: "nested #{ inspect %{ :interpolation => %{} } }" }
  } }
  """
  defstruct [:a, :name, :height]

  @doc ~S'''
  No #{interpolation} of any kind.
  \000 \x{ff}

  \n #{\x{ff}}
  '''
  def func(a, b \\ []), do: :ok

  # Function
  def f(x), do: x
  # Operator definition (don't highlight the `x`!)
  def x + y, do: nil
  def x * y, do: nil
  def x |> y, do: nil
  def x && y, do: nil
  def x || y, do: nil
  # Word operators
  def x and y, do: nil
  def x or y, do: nil
  def x in y, do: nil
  # unquote, quote and unquote_splicing:
  def quote(f)(x), do: nil
  def unquote(f)(x), do: nil
  def unquote_splicing(f)(x), do: nil
  # function name that starts with `quote`:
  def quote_me(x), do: nil

  @doc false
  def __before_compile__(_) do
    :ok
  end
end

# Structs
defmodule Second.Module do
  s = %Long.Module.Name{name: "Silly"}
  %Long.Module.Name{s | height: {192, :cm}}
  ".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
end

# Types, pseudo-vars, attributes
defmodule M do
  @custom_attr :some_constant

  @before_compile Long.Module.Name

  @typedoc "This is a type"
  @type typ :: integer

  @typedoc """
  Another type
  """
  @opaque typtyp :: 1..10

  @spec func(typ, typtyp) :: :ok | :fail
  def func(a, b) do
    a || b || :ok || :fail
    Path.expand("..", __DIR__)
    IO.inspect __ENV__
    __NOTAPSEUDOVAR__ = 11
    __MODULE__.func(b, a)
  end

  defmacro m() do
    __CALLER__
  end
end

# Functions
anon = fn x, y, z ->
  fn(a, b, c) ->
    &(x + y - z * a / &1 + b + div(&2, c))
  end
end

&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) )

# Function calls
anon.(1, 2, 3); self; hd([1,2,3])
Kernel.spawn(fn -> :ok end)
IO.ANSI.black

# Control flow
if :this do
  :that
else
  :otherwise
end

pid = self
receive do
  {:EXIT, _} -> :done
  {^pid, :_} -> nil
  after 100 -> :no_luck
end

case __ENV__.line do
  x when is_integer(x) -> x
  x when x in 1..12 -> -x
end

cond do
  false -> "too bad"
  4 > 5 -> "oops"
  true -> nil
end

# Lexical scope modifiers
import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2]
alias Long.Module.Name, as: N0men123_and4
use Bitwise

4 &&& 5
2 <<< 3

# Protocols
defprotocol Useless do
  def func1(this)
  def func2(that)
end

defimpl Useless, for: Atom do
end

# Exceptions
defmodule NotAnError do
  defexception [:message]
end

raise NotAnError, message: "This is not an error"