Web pages as input
A web page is an input like a book: an .html (.htm, .xhtml) file, or the http(s) address of
a page (kakemono convert https://en.wikipedia.org/wiki/Fourier_transform -o ft.md). The page is
parsed as a browser parses it (html5ever), its article is kept and written as one XHTML document,
which is read as an EPUB book is (above): headings, lists, tables, MathML formulas, code, figures
with their captions, notes and links come out the same way.
- The article. Scripts, forms, navigation (
<nav>,<aside>, the header and footer of the page), elements with the roles of navigation, banners, dialogs and search, hidden elements (hidden,display: none), and elements whose class oridnames clutter (menus, sidebars, sharing buttons, advertisements, cookie notices, newsletters, “related” lists, comments) are removed, unless they hold the title or most of the text. The article is then the element where the text stops being in one child, text in links not counting (as Firefox’s reader view finds it).<br><br>ends a paragraph. - Title and authors. The title is the first
<h1>of the article, else the first of the page when it is in the same<article>or<main>or is the page’s<title>, elseog:titleor the<title>without the name of the site. The authors come fromcitation_author,authororarticle:author, unless the page marks its own (class="author"). - Pictures. The best version of each picture is taken (the smallest of a
srcsetat least 1600 pixels wide, a<picture>’s sources but AVIF, the address of a lazy picture indata-srcor in<noscript>), fitted to the page; icons and tracking pixels (under 48 pixels) are left out. A page at an address has its pictures fetched with it (8 at a time, 300 at most); a file has them read next to it;data:pictures are inside the page. PNG, JPEG, GIF, BMP, WebP and SVG are drawn. - Notes. A short link in a superscript to an item of a list (Wikipedia’s
[1], most blogs’ notes) calls a note, which follows its paragraph as a footnote, without its link back; so does pandoc’srole="doc-noteref". - Sites. arXiv’s HTML papers (LaTeXML): notes written in place, each author with their
addresses, the abstract. Wikipedia: its notes, edit links, maintenance boxes and navigation
boxes. Sphinx and mdBook: the
¶and self-links of headings. - Encoding. The byte order mark, the
charsetof the HTTP response, then a<meta>near the start; otherwise UTF-8, or Windows-1252 for bytes that are not UTF-8.
A page saved as a file is read as at its address with --base-url (kakemono convert saved.html --base-url https://example.org/a/page.html -o page.md): its links point there,
and its pictures are fetched from there.
arXiv addresses (/abs/, /pdf/, /html/) still give the paper’s PDF, which the analysis reads
with its pages; another address of a PDF, a Word document or an EPUB book gives that document. A
page has no pages: all four HTML modes give the friendly article, and -o page.pdf lays it out
through a Word document. Pages built by scripts in the browser (an empty <body> filled by
JavaScript) cannot be read, nor pages behind a login or a paywall; the pictures of a local file
are not fetched from the Web.