class
Markd::Pdf::Renderer
- Markd::Pdf::Renderer
- Reference
- Object
Defined in:
pdf_renderer.crConstructors
Instance Method Summary
-
#add_css(css : String) : Nil
Layer extra CSS on top of the style (later layers win on equal specificity, like repeated --css flags in the CLI).
- #base_dir : String
- #code_theme : String?
-
#css : String
The complete stylesheet this renderer uses: the built-in style, then the theme (when set), then the kdp production layer, then user layers — each later block winning on equal specificity.
- #css_layers : Array(String)
- #footer : String
- #header : String
- #html_input : Bool
- #hyphenate : Bool
- #language : String
- #margin_mm : Float64
- #options : Markd::Options
- #page_size : String
- #pageless : Bool
-
#render(source : String, output_path : String) : Int32
Render markdown — or a complete HTML document — to output_path.
-
#render_to_memory(source : String) : Bytes
Render markdown — or a complete HTML document — to bytes in memory: no PDF file is ever written.
-
#render_to_memory_with_headings(source : String, toc_html : String | Nil = nil) : Tuple(Bytes, Int32, Array(HeadingEntry))
The in-memory twin of render_with_headings: same TOC block and heading map, but the PDF comes back as bytes instead of a file.
-
#render_with_headings(source : String, output_path : String, toc_html : String | Nil = nil) : Tuple(Int32, Array(HeadingEntry))
Render with an optional TOC block, as Pdf.toc_html builds it: the block is injected ahead of the body and every heading gets a #mtoc-N anchor the entries can link to.
- #style : String
- #theme : String?
Constructor Detail
Instance Method Detail
Layer extra CSS on top of the style (later layers win on equal specificity, like repeated --css flags in the CLI).
The complete stylesheet this renderer uses: the built-in style, then the theme (when set), then the kdp production layer, then user layers — each later block winning on equal specificity.
Render markdown — or a complete HTML document — to output_path. Returns the page count; raises Markd::Pdf::Error on failure.
Render markdown — or a complete HTML document — to bytes in memory: no PDF file is ever written. Only images that need converting pass through a private temp directory, deleted right after the render. Raises Markd::Pdf::Error on failure.
The in-memory twin of render_with_headings: same TOC block and heading map, but the PDF comes back as bytes instead of a file.
Render with an optional TOC block, as Pdf.toc_html builds it: the block is injected ahead of the body and every heading gets a #mtoc-N anchor the entries can link to. Returns the page count and the heading map the layout produced (index, level, 1-based page, title per heading) — the raw material the two-pass TOC in Markd::Pdf.settled_pages rebuilds the block from. Raises Markd::Pdf::Error on failure.