mischov / pearly

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pearly

Build Status Pearly 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. -- 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.

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

  • 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

License

Pearly is licensed under the MIT License

About

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

License:MIT License


Languages

Language:Elixir 43.1%Language:Rust 37.5%Language:HTML 19.4%