Skip to main content

render

Function render 

Source
pub fn render(
    input: &str,
    is_js: bool,
    page_url: Option<&str>,
    cfg: &HttpConfig,
    clean: bool,
    max_scripts: Option<usize>,
    script_timeout: Option<Duration>,
) -> Result<String>
Expand description

Parse input, execute its scripts, and return the rendered HTML.

is_js โ€” when true, input is treated as a bare JS snippet and wrapped in a minimal HTML document before processing (used for .js file inputs).

page_url โ€” the URL the page was fetched from, used for resolving relative script src attributes and populating window.location.

Script errors are non-fatal; execution continues with the next script. console.log/warn/error output is printed to stderr with a [console] prefix.

When clean is true a post-processing pass is applied (see clean_document).

ยงErrors

Returns an error if the JS bootstrap fails to evaluate.