Skip to main content

Crate chordsketch_render_html

Crate chordsketch_render_html 

Source
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 Song AST to an HTML5 document string.
render_song_with_transpose
Render a Song AST to an HTML5 document with an additional CLI transposition offset.
render_song_with_warnings
Render a Song AST 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.