← Back

CodeBlock

[basic]

CodeBlock: structured syntax tokens via Raxol.UI.SyntaxHighlighter (same path as DiffViewer); theme :one_dark by default

CodeBlock Demo

CodeBlock: structured syntax tokens via Raxol.UI.SyntaxHighlighter (same path as DiffViewer); theme :one_dark by default

For the full interactive experience:

$ mix raxol.playground

Code
blocks =
  Enum.with_index(@samples)
  |> Map.new(fn {sample, idx} ->
    {:ok, state} =
      CodeBlock.init(%{
        id: "code-#{idx}",
        content: String.trim_trailing(sample.content),
        language: sample.language
      })

    {idx, state}
  end)
demo j/k prev/next / focus demo esc back 16/42 demos