git.y1.nz

digest-html

Converts HTML to plaintext-with-links.
download: http://git.y1.nz/archives/digest-html.tar.gz
README | Files | Log | Refs

digest-html.1

      1 .Dd July 12, 2026
      2 .Dt DIGEST-HTML 1
      3 .Os
      4 .Sh NAME
      5 .Nm digest-html
      6 .Nd Simple HTML to plaintext-with-links converter
      7 .Sh SYNOPSIS
      8 .Nm
      9 .Op Fl d
     10 .Op Fl o Ar OUTFILE
     11 .Op Fl b Ar BASEURI
     12 .Ar HTMLFILE
     13 .Sh DESCRIPTION
     14 .Nm
     15 converts the contents of
     16 .Ar HTMLFILE
     17 into a human-readable plaintext format, which is written to standard out.
     18 
     19 Many HTML elements that include a URI in some attribute are translated into a
     20 "link" format similar to the one used in markdown. For example, the HTML
     21 anchor element <a href="http://foo.com">foo</foo> gets rendered as
     22 [foo](http://foo.com). The following table describes the way that each tag
     23 is rendered into a link in the default configuration:
     24 
     25 .TS
     26 allbox tab(|);
     27 r r l.
     28 Tag Name | Destination | Text
     29 a | <href> | {contents}
     30 img | <src> | <alt> ?? <title> ?? {contents}
     31 audio | <src> | audio:<title>
     32 video | <src> | video:<title>
     33 form | <action> | FORM:<id> {contents} 
     34 .TE
     35 
     36 In this table, <attrname> represents the value of the named attribute. Similarly,
     37 {contents} represents the recursively-rendered contents of the element. "??"
     38 indicates that if the value to the left is empty or undefined, the expression on
     39 the right will be used instead. 
     40 
     41 If the destination's value is a valid URI reference as defined by [RFC3986], it
     42 will be resolved relative to the base URI specified by either a <base> tag or the
     43 .Op -b
     44 option (in that order). If there is no valid base URI, or if the original
     45 destination value is not a valid relative URI reference, the destination is
     46 translated without being changed.
     47 
     48 .Sh OPTIONS
     49 .Bl -tag -width Ds
     50 .It Fl d
     51 If present, all html tags without behavior explicitly defined in translate.c will
     52 be rendered as a link with the element's contents as the link text, and the
     53 destination "unknown tag- 'TAGNAME'". For example, if -d is specified, the element
     54 .B <dfn>baz<a href="b">c</a></dfn>
     55 is rendered as
     56 .B [baz [c](b)](unknown tag- "dfn") .
     57 .It Fl o Ar OUTFILE
     58 If present, the digested page is written into the specified file instead of stdout.
     59 .It Fl b Ar BASEURI
     60 All destinations that are valid URIs according to [RFC3986] will be resolved
     61 as relative to
     62 .Ar BASEURI
     63 by default. If the HTML document specifies a valid base URI using a <base> tag,
     64 that URI will be used instead of the one specified using the -b
     65 option.
     66 .El
     67 .Sh EXIT STATUS
     68 .Ex -std
     69 .Sh SEE ALSO
     70 .Xr bro 1
     71 .Xr lwl 1
     72 .Xr wget 1
     73 .Xr 
     74 .Sh AUTHORS
     75 .An Emma Weaver Aq Mt emma@y1.nz

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.