HtmlToMarkdown.HiddenContent (html_to_markdown v3.18.5)

Copy Markdown

Which text that a browser does not show at first the output holds.

The choice answers one question: can a reader get to the text? It does not depend on how the page hides it.

MarkupDropReachableAll
An element with the hidden attribute, any value (hidden="until-found" too)droppedkeptkept
An element with inline display: none, visibility: hidden or font-size: 0droppedkeptkept
An element of an inline <svg> with display="none" or visibility="hidden"droppedkeptkept
A declarative shadow root: a <template> whose shadowrootmode is open or closeddroppedkeptkept
Any other <template>, and <noscript>droppeddroppedkept
<script>, <style>, comments, the value of <input type="hidden">droppeddroppeddropped

aria-hidden is not hidden for this option. It takes an element away from assistive technology only: a browser still shows the element, so a reader sees its text, and every choice keeps it. One rule is older than this option and does not change with it: for an inline <svg aria-hidden="true"> no choice writes the title, the description or the label of the graphic.

Every choice also keeps what the converter never treated as hidden: inert, a closed <details> or <dialog>, <datalist> and <option> text, and an element hidden by a class name, a style sheet rule, opacity, content-visibility, a zero size or an off-screen position. The converter reads the inline style attribute only. It does no layout and reads no style sheet, so it cannot tell that a rule in a style sheet hides an element.

A kept element converts like the same element without the attribute or style. Kept <template> and <noscript> content converts where it is written, as if the two tags were not there: a row in a <template> inside a <table> is a row of that table, and the content of a declarative shadow root comes before the other children of its host element. Slots are not resolved. All keeps <noscript> content with every preprocessing preset. A <template> or <noscript> in the document head holds metadata (<link>, <meta>, <style>), not text for a reader, and no choice keeps it. A document with no <head> tag has a head too: it starts at the doctype, at the <html> tag or at the first metadata element, and it ends where the body starts.

Summary

Types

t()

Which text that a browser does not show at first the output holds.

Functions

Keep what Reachable keeps, and the content of <template> and <noscript>. A reader gets to that text only after a script copies it into the page, or with scripting off.

Drop the text a browser does not show at first. Default.

Keep the text of elements that are in the page and that the page can show: an inactive tab panel, a collapsed section, an answer shown on a click, a declarative shadow root.

Returns the serde wire value this variant carries on the JSON boundary (see wire_variant_value in alef's naming module) -- distinct from the atom's Elixir spelling.

Types

t()

@type t() :: :drop | :reachable | :all

Which text that a browser does not show at first the output holds.

Functions

all()

@spec all() :: t()

Keep what Reachable keeps, and the content of <template> and <noscript>. A reader gets to that text only after a script copies it into the page, or with scripting off.

drop()

@spec drop() :: t()

Drop the text a browser does not show at first. Default.

reachable()

@spec reachable() :: t()

Keep the text of elements that are in the page and that the page can show: an inactive tab panel, a collapsed section, an answer shown on a click, a declarative shadow root.

wire_value(atom)

@spec wire_value(t()) :: String.t()

Returns the serde wire value this variant carries on the JSON boundary (see wire_variant_value in alef's naming module) -- distinct from the atom's Elixir spelling.