Skip to main content

render_html

Function render_html 

Source
pub fn render_html(nodes: &[Node], options: &RenderOptions) -> String
Expand description

Renders an AST to an HTML fragment (<div class="hl-receipt">). Include STYLESHEET once on the page, or use render_html_document.

All receipt text is escaped, so the output is safe to insert into a page.

use hardless_escpos::parse;
use hardless_render::{render_html, RenderOptions};
let html = render_html(&parse(b"<b>Hi</b>\n"), &RenderOptions::default());
assert!(html.contains("&lt;b&gt;Hi&lt;/b&gt;"));