Skip to main content

compile_html

Function compile_html 

Source
pub fn compile_html(
    html: &str,
    author_stylesheets: &[(Stylesheet, Origin)],
) -> Chapter
Expand description

Compile HTML content to IR.

This is the main entry point for the compiler pipeline. Automatically detects XHTML and uses the appropriate parser.

§Arguments

  • html - The HTML content to parse
  • stylesheets - Author stylesheets with their origins (user-agent stylesheet is added automatically)

§Returns

A Chapter containing the normalized content tree.

§Example

use boko::{compile_html, Stylesheet, Origin};

let html = "<p class='intro'>Welcome!</p>";
let css = ".intro { font-weight: bold; }";

let author = Stylesheet::parse(css);
let chapter = compile_html(html, &[(author, Origin::Author)]);