Html2Markdown.ElementTypes (html2markdown v0.3.0)
Provides element type classification for HTML to Markdown conversion.
This module categorizes HTML elements into block, inline, and other types to enable proper spacing and formatting decisions during conversion.
Summary
Functions
Determines if an HTML element is a block-level element.
Determines if an element should be treated as content.
Determines if processed content is empty.
Determines if an HTML element is a heading element.
Determines if an HTML element is an inline element.
Determines if an HTML element is a list element.
Functions
Determines if an HTML element is a block-level element.
Block elements typically start on a new line and take up the full width available. They should be separated by blank lines in markdown.
Examples
iex> Html2Markdown.ElementTypes.block_element?("p")
true
iex> Html2Markdown.ElementTypes.block_element?("span")
false
@spec content_node?(Floki.html_node()) :: boolean()
Determines if an element should be treated as content.
This is used to filter out empty text nodes, comments, etc.
Determines if processed content is empty.
Used to filter out elements that produce no markdown output.
Determines if an HTML element is a heading element.
Examples
iex> Html2Markdown.ElementTypes.heading_element?("h1")
true
iex> Html2Markdown.ElementTypes.heading_element?("h7")
false
Determines if an HTML element is an inline element.
Inline elements flow within text and don't create line breaks. They should not have extra spacing added around them.
Examples
iex> Html2Markdown.ElementTypes.inline_element?("em")
true
iex> Html2Markdown.ElementTypes.inline_element?("p")
false
Determines if an HTML element is a list element.
Examples
iex> Html2Markdown.ElementTypes.list_element?("ul")
true
iex> Html2Markdown.ElementTypes.list_element?("li")
true
iex> Html2Markdown.ElementTypes.list_element?("p")
false