@leandown/core
v0.0.23
Published
Pluggable Lean 4 code highlighting via the Lean LSP
Readme
leandown
A remark plugin that provides Verso-like features.
Quick start
You need Lean installed.
import { remark } from "remark";
import remarkHtml from "remark-html";
import remarkLean from "@leandown/remark";
const html = await remark()
.use(remarkLean)
.use(remarkHtml, { sanitize: false })
.process(markdown);Then, include the runtime in your page to activate hover behavior.
import { leanHydrate } from "@leandown/core/runtime";
leanHydrate();Default styles are shipped in @leandown/core/lean.css.
See examples in examples.
Typst output
TypstBackend renders Lean blocks as Typst markup (Typst 0.15+). The output
calls lean-block and lean-token, which are defined in the shipped preamble:
include @leandown/core/lean.typ (also exported as the TYPST_PREAMBLE
string) once per document, or define your own versions to restyle it.
import { LeanHighlightProcessor, TypstBackend, TYPST_PREAMBLE } from "@leandown/core";
const processor = new LeanHighlightProcessor({ backend: new TypstBackend() });
const typ = TYPST_PREAMBLE + (await processor.processBlock("def x : Nat := 1"));