guidedoc_html ============= .. rust:crate:: guidedoc_html :synopsis: The HTML renderer of Guidedoc. The HTML renderer of Guidedoc. The default output is semantic HTML with anchors, notes, and tables, in the element structure Docutils' and Sphinx's HTML writers use; the reference profile (``RenderOptions::reference_profile``) reproduces the CommonMark reference renderer byte for byte, for conformance tests. Raw content and unsafe URLs are governed by the conversion policy. .. code-block:: rust use guidedoc::Registry; let registry = Registry { renderers: vec![guidedoc_html::RENDERER], ..Registry::default() }; assert!(registry.find_renderer("html").is_some()); .. rubric:: Re-exports .. rust:use:: pub use guidedoc::MATHML_ATTRIBUTES .. rust:use:: pub use guidedoc::MATHML_ELEMENTS .. rust:use:: pub use guidedoc::MAX_MATHML_BYTES .. rust:use:: pub use guidedoc::MAX_MATHML_DEPTH .. rust:use:: pub use guidedoc::MathMlDropped .. rust:use:: pub use guidedoc::MathMlError .. rust:use:: pub use guidedoc::MathMlOptions .. rust:use:: pub use guidedoc::filter_mathml .. rubric:: Functions .. rust:function:: pub fn renderer() -> Renderer Returns ``RENDERER``, the HTML renderer descriptor. .. rust:function:: pub fn render(ctx: &mut RenderContext<'_>) -> Result<(), Fail> Writes ``ctx.doc`` as HTML through ``ctx.out``: a whole page when ``ctx.options.standalone``, else a fragment, and the CommonMark reference renderer's bytes when ``ctx.options.reference_profile``. It borrows the context for the call and keeps only its working storage, in the context's scratch store. Problems go to the context's reports; the render fails with the status of the first error: raw content or a URL the policy refuses (``Policy``), an unresolved reference (``InvalidInput``), or nesting past the limits (``Limit``). .. rubric:: Constants .. rust:const:: pub const SOURCE_ATTRIBUTE: &str = "data-gd-source" The attribute that carries a block's source span. .. rust:const:: pub const VERSION: &str = env!("CARGO_PKG_VERSION") The renderer's version: the project version every crate inherits. .. rust:const:: pub const CONFORMANCE: Conformance = Conformance::Partial How completely the renderer implements HTML output. .. rust:const:: pub const RENDERER: Renderer The "html" renderer descriptor, for a ``guidedoc::Registry``. It is a value with no state: registering a copy is harmless. .. rust:const:: pub const RAW_REFUSED: Message Raw content the policy refuses; ``{0}`` names its format. .. rust:const:: pub const RAW_OMITTED: Message Raw HTML the policy leaves out. .. rust:const:: pub const RAW_FORMAT: Message Raw content for another format, which HTML cannot show. .. rust:const:: pub const URL_UNSAFE: Message A link target whose scheme can run code, refused by the policy. .. rust:const:: pub const URL_OMITTED: Message A link target whose scheme can run code, left out by the policy. .. rust:const:: pub const MATHML_DROPPED: Message MathML an author wrote, with parts outside MathML Core left out. .. rust:const:: pub const MATHML_INVALID: Message MathML an author wrote that is not one well-formed ``math`` element. .. rust:const:: pub const UNRESOLVED: Message A reference that leads nowhere. .. rust:const:: pub const EXPANSION: Message Substitutions expanding through more than ``Limits::max_expansion`` levels.