Html2Typst

object Html2Typst

HTML -> Typst markup converter. Ported from adriandelgado/html2typst (Rust, MIT, github.com/adriandelgado/html2typst/blob/main/src/lib.rs) and extended with <pre>/<code>/<table> support, which upstream leaves as todo!() — the two element types that make up the bulk of Dokka-generated API docs.

One deliberate deviation from upstream: it panic!()s on any tag it doesn't recognize (hr, q, cite, details, summary, iframe, and a catch-all _). This port falls back to rendering the tag's descendants instead — matching this repo's own rule (see MdxEscaper.HtmlFallback) that an unrecognized construct degrades gracefully rather than breaking the build.

Not ported (upstream doesn't implement them either): colspan/rowspan on table cells are ignored — each cell renders once, in place, uncombined.

Found only by running this against real gradle dokkaGenerate output (see RealDokkaFixtureTest), not visible from hand-written test HTML: Dokka's per-member "copy link" affordance renders as visible text ("Link copied to clipboard") inside class="anchor-wrapper", which would otherwise leak into the converted prose as if it were documentation content. Skipped entirely.

Functions

Link copied to clipboard
fun convert(html: String): String