element.version === currentVersion)) { versionNodes.unshift({ version: currentVersion, url: "#" }); } document.querySelector("#project-version").innerHTML = versionNodes.reduce( (acc, element) => { const status = currentVersion === element.version ? "selected disabled" : ""; return ` ${acc} `; }, `
contour · v1.2.1

Contour 💅

A Gleam syntax highlighter in Gleam

Package Version Hex Docs

gleam add contour@1
import contour

pub fn main() {
  let source =
    "import gleam/io

pub fn main() {
  io.println(\"hello, friend!\")
}"

  // Highlight using ansi codes, suitable for showing in the terminal
  contour.to_ansi(source)
  |> io.println

  // Convert to HTML with CSS classes for colours
  let html = contour.to_html(source)
  io.println("<pre><code>" <> html <> "</code></pre>")

  // Or convert to tokens and the highlight in any way you desire
  contour.to_tokens(source)
  |> do_something_with_tokens
}

Further documentation can be found at https://hexdocs.pm/contour.

Search Document