Pearly

Build StatusPearly version

Pearly Soames wanted gold and silver, but not, in the way of common thieves, for wealth. He wanted them because they shone and were pure. Strange, afflicted, and deformed, he sought a cure in the abstract relation of colors. – <cite>Mark Helprin, Winter’s Tale</cite>

Pearly is an Elixir library for syntax highlighting using Sublime Text syntax definitions.

Pearly.highlight("html", "<h1>Hello, World!</h1>",
  format: :html,
  theme: "Solarized (dark)")
#=> {:ok, "<pre style=\"background-color:#002b36;\">\n<span style=..."}

Pearly currently supports formatting output for either HTML pages or the terminal.

See HexDocs for additional documentation.

Dependencies

Pearly depends on the Rust library Syntect, and you will need to have the Rust compiler installed.

Additionally, one of Syntect’s dependencies (onig) requires cmake to be installed.

Installation

Ensure Rust and cmake are installed, then add Pearly to your mix.exs:

defp deps do
  [
    {:pearly, "~> 0.1.1"}
  ]
end

Finally, run mix deps.get.

Roadmap

License

Pearly is licensed under the MIT License