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. -- Mark Helprin, Winter's Tale
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.
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.
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
.
- Highlight for HTML pages (styled
<pre>
tags) - Highlight for the terminal (24-bit color ANSI terminal escape sequences)
- Provide Elixir and EEx syntaxes
- Support providing additional syntaxes
- Support providing additional themes
- Support additional and/or custom formatters
Pearly is licensed under the MIT License