HTML page CLI (md2html)
Command-line interface (md2html) and HTML5 page wrapper for rendering Markdown to standalone HTML pages.
page
def page(
body:str, # Exported HTML body fragment (e.g. from `mdhtml2html`)
title:str='mdhtml', # HTML `<title>` text
theme:str='vscode_light', # Light-mode `fastpylight` theme name
dark_theme:str='vscode_dark', # Dark-mode `fastpylight` theme name
preview:bool=False, # Include preview dialect CSS rules?
math:bool=True, # Load KaTeX CSS/JS and `math_js()` for math rendering?
head:tuple[str, ...]=(), # Extra verbatim `<style>`, `<script>`, or `<link>` strings for `<head>`
)->str: # Complete standalone HTML5 document
Wrap an exported HTML body fragment in a standalone HTML5 page with dialect CSS, syntax theme CSS, and optional KaTeX and Mermaid scripts.
main
def main(
file:str=None, # Markdown file to read (default: stdin)
out:str=None, # Where to write: a path, `-` for stdout; omitted opens a browser, or writes to stdout when piped
fragment:bool=False, # Emit the body fragment alone, with no page shell
refs:mdhtml.md2html.RefsMode=<RefsMode.ids: 'ids'>, # Bake references as target ids, with numbering ('resolve'), or numbering that degrades to ids ('lenient')
number_headings:mdhtml.md2html.NumMode=None, # Heading numbering scheme (default: the frontmatter's `number_headings:`, else automatic)
cite_style:str=None, # Citation style: author-year or numeric; None uses metadata
toc:bool=False, # Prepend a table of contents
hl:mdhtml.md2html.HlMode=<HlMode.spans: 'spans'>, # Code highlighting: classed spans, the Highlight API, or off
theme:str='vscode_light', # Code colors in light mode: any name from `fastpylight.themes()`
dark_theme:str='vscode_dark', # Code colors in dark mode
templates:bool=True, # Show mustache `{{tokens}}` as styled pills
auto_ids:bool=True, # Derive ids for headings
gh_ids:bool=False, # Derive heading ids by GitHub's rules, matching anchors on a GitHub-rendered page
implicit_figures:bool=True, # Promote image-only paragraphs to figures
frontmatter:bool=False, # Recognize leading `key: value` frontmatter: strip it, title the page, prepend a metadata table
*, math:mdhtml._cli.MathMode=<MathMode.brackets: 'brackets'>, # Math delimiters to recognize
bare_autolinks:bool=True, # Autolink bare URLs and email addresses
):
Read Markdown and write a finished HTML page