Skip to main content

render_document_with_spans

Function render_document_with_spans 

Source
pub fn render_document_with_spans(
    ast: &[Element],
    config: &RenderConfig<'_>,
    input: &str,
) -> String
Expand description

Render a document to semantic HTML with span data attributes

Each element will have data-start and data-end attributes with UTF-16 offsets. This is useful for editor synchronization (e.g., highlighting preview elements based on cursor position).

ยงArguments

  • ast - The parsed AST elements
  • config - Render configuration (include_spans should be true)
  • input - Original input text for UTF-16 offset calculation