# Convert stdinecho'<h1>Title</h1><p>Content</p>'|html-to-markdown
# Convert a filehtml-to-markdowninput.html
# Convert a file and save outputhtml-to-markdowninput.html-ooutput.md
# Fetch and convert a remote URLhtml-to-markdown--urlhttps://example.com>output.md
--json swaps the default Markdown output for a full ConversionResult object: content, metadata, tables, document, images, and warnings on a single JSON value. The flags in this section control which fields are populated.
Flag
Description
--json
Output a full ConversionResult as JSON instead of Markdown.
--include-structure
Populate document with the parsed semantic tree. Requires --json.
--extract-inline-images
Populate images with extracted data URIs and SVGs. Requires --json.
--no-content
Skip Markdown rendering. content is empty, metadata and structure still populate. Requires --json.
--show-warnings
Print each processing warning to stderr as Warning [<kind>]: <message>. Works with or without --json.
# Web scraping with aggressive preprocessinghtml-to-markdownpage.html--preprocess--presetaggressive
# Extract full structured result as JSONhtml-to-markdowninput.html--json\--extract-metadata--include-structure\-ooutput.json
# Discord/Slack-friendly output (2-space list indents)html-to-markdowninput.html--list-indent-width2# Custom heading and list styleshtml-to-markdowninput.html\--heading-styleatx\--bullets'*'\--list-indent-width2# Fetch and convert with Djot outputhtml-to-markdown--urlhttps://example.com--output-formatdjot
Each CLI flag has a corresponding ConversionOptions field. Library users can cross-reference here when translating a CLI invocation to code (or vice versa).
CLI Flag
ConversionOptions field
Notes
--output-format FORMAT
output_format
"markdown" | "djot" | "plain" | "none"
--heading-style STYLE
heading_style
"atx" | "underlined" | "atx-closed"
--list-indent-type TYPE
list_indent_type
"spaces" | "tab"
--list-indent-width N
list_indent_width
integer
--bullets CHARS
bullets
string
--strong-em-symbol CHAR
strong_em_symbol
"*" | "_"
--newline-style STYLE
newline_style
"backslash" | "spaces"
--sub-symbol SYMBOL
sub_symbol
string
--sup-symbol SYMBOL
sup_symbol
string
--highlight-style STYLE
highlight_style
"double-equal" | "html" | "bold" | "none"
--escape-asterisks
escape_asterisks
boolean flag
--escape-underscores
escape_underscores
boolean flag
--escape-misc
escape_misc
boolean flag
--escape-ascii
escape_ascii
boolean flag
--code-block-style STYLE
code_block_style
"indented" | "backticks" | "tildes"
-l, --code-language LANG
code_language
string
--no-autolinks
autolinks
inverted: flag sets autolinks = false; default is true
--default-title
default_title
boolean flag
--link-style STYLE
link_style
"inline" | "reference"
--keep-inline-images-in ELEMS
keep_inline_images_in
comma-separated tag list
--skip-images
skip_images
boolean flag
--br-in-tables
br_in_tables
boolean flag
--whitespace-mode MODE
whitespace_mode
"normalized" | "strict"
--strip-newlines
strip_newlines
boolean flag
-w, --wrap
wrap
boolean flag
--wrap-width N
wrap_width
integer
--convert-as-inline
convert_as_inline
boolean flag
--strip-tags TAGS
strip_tags
comma-separated tag list
--preserve-tags TAGS
preserve_tags
comma-separated tag list
--max-depth N
max_depth
integer
--extract-metadata
extract_metadata
boolean flag
--include-structure
include_document_structure
boolean flag; --json only
--extract-inline-images
extract_images
boolean flag; --json only
-p, --preprocess
preprocess
boolean flag
--preset LEVEL
preset
"minimal" | "standard" | "aggressive"
--keep-navigation
keep_navigation
boolean flag
--keep-forms
keep_forms
boolean flag
-e, --encoding ENCODING
encoding
CLI only — decoded before convert()
--debug
debug
CLI only — diagnostic output to stderr
Flags without a ConversionOptions counterpart: FILE, --url, --user-agent, -o/--output, --json, --no-content, --show-warnings, --generate-completion, --generate-man.