Expand description
HTML renderer for ChordPro documents.
Converts a parsed ChordPro AST into a self-contained HTML5 document with embedded CSS for chord-over-lyrics layout.
§Security
Delegate section environments ({start_of_svg}, {start_of_abc},
{start_of_ly}, {start_of_textblock}) emit their content as raw,
unescaped HTML. This is by design per the ChordPro specification, as these
sections contain verbatim markup (e.g., inline SVG).
SVG sections are sanitized by default: <script> elements and event
handler attributes (onload, onerror, etc.) are stripped to prevent
XSS. When rendering untrusted ChordPro input, consumers should still
apply Content Security Policy (CSP) headers as additional defense.
Functions§
- render
- Parse a ChordPro source string and render it to HTML.
- render_
song - Render a
SongAST to an HTML5 document string. - render_
song_ with_ transpose - Render a
SongAST to an HTML5 document with an additional CLI transposition offset. - render_
song_ with_ warnings - Render a
SongAST to an HTML5 document, returning warnings programmatically. - render_
songs - Render multiple
Songs into a single HTML5 document. - render_
songs_ with_ transpose - Render multiple
Songs into a single HTML5 document with transposition. - render_
songs_ with_ warnings - Render multiple
Songs into a single HTML5 document, returning warnings programmatically. - try_
render - Parse a ChordPro source string and render it to HTML.