Skip to main content

Crate adocers_html

Crate adocers_html 

Source
Expand description

The HTML5 back end for AsciiDoc.

asciidoc-parser renders inline content — bold, links, cross-references, passthroughs — but deliberately stops there: turning the block tree into a page is the back end’s job, and this crate is that back end. The markup it emits follows Asciidoctor’s HTML5 converter (the same wrapper divs and class names), so stylesheets written for Asciidoctor apply unchanged.

§A back end we could adopt instead

asciidoc-html5 is the parser author’s own HTML5 back end, and it covers what this crate covers: rendered against resources/showcase.adoc the two agree on every wrapper and class name, and on constructs the showcase leaves out — video, audio, bibliographies, roles, hard breaks, passthroughs — they agree byte for byte. Both are bounded by the same parser, so neither is ahead on coverage.

Adopting it would mean giving up what this crate does beyond Asciidoctor, with no supported way to add it back:

  • source blocks highlighted here rather than in the browser, which that crate rules out (“client-side syntax highlighters only”);
  • mermaid blocks turned into diagrams, which it renders as listings;
  • admonitions marked with an icon rather than a label;
  • the labelled document header.

Its README also rules out an extension mechanism before 1.0, so hooking those back in would mean rewriting its output rather than configuring it.

It is worth revisiting if that changes — or if the long tail of Asciidoctor fidelity becomes more work than it is worth. That tail is now measured rather than guessed at: the workspace’s tests/doctest.rs renders Asciidoctor’s own test corpus through this back end and compares the result against Asciidoctor’s, and KNOWN_FAILURES there is the whole of what does not match yet.

Structs§

Options
How the rendered body should be wrapped.
Page
Everything about a standalone page that is not its body markup.
Rendered
What a render produced.

Functions§

default_stylesheet
The stylesheet embedded in a standalone page when the caller names no other.
document_stylesheet
The rules for a document’s own content, for a host that supplies the page.
escape_attr
Escape a value destined for a double-quoted attribute.
escape_text
Escape the characters that would otherwise start markup in element content.
page
Wrap body markup in a complete HTML page.
render
Render document to HTML.
stylesheet_variables
The custom properties the document rules — and every drawn diagram — read.
toc_stylesheet
The rules for the outline, for a host that places one itself.