HXADDID(1)
π HXADDID(1) π
okay bestie, welcome to hxaddid β part of the HTML-XML-utils crew (that's the HTML-XML-utils manual set, hi π). she adds IDs to the elements you pick. that's literally her whole personality and she ate.
β¨ NAME β¨
hxaddid β add IDs to selected elements π
πΈ SYNOPSIS πΈ
hxaddid [ -x ] [--] elem|.class|elem.class [ file-or-URL ]
π¦ DESCRIPTION π¦
so here's the vibe: hxaddid copies an HTML or XML file over to standard output, and while she's doing it she sprinkles element IDs onto the elements or classes you asked for. lowkey magic β¨
like, imagine your input is
<p>A paragraph without an ID</p>
and then you run
hxaddid p
and she gives you back
<p id="a-paragraph">A paragraph without an ID</p>
iconic. the paragraph has an identity now π
if you specify a class with .class, then IDs only get added to elements that contain that class. and if you specify an element and a class together with elem.class, then IDs only get added to the specified elements that contain the specified class. selective queen π
now, if two elements would naturally generate the same ID, a number gets tacked onto the ID name (starting with 0) so the IDs stay unique. no dupes, no drama. and heads up β IDs are not added to matching elements that already contain an ID. she knows when to leave a girl alone π
π OPTIONS π
here's what she supports:
-xβ use XML conventions: empty elements get written with a slash at the end, like<IMG />. also, this makes the element get matched case-sensitively. so, like, pick a lane and commit bestie.
π OPERANDS π
the following operands are supported:
elemβ the name of the element to select..classβ the name of the class to select.elem.classβ the name of the element that contains the class to select.file-or-URLβ the name or URL of an HTML or XHTML file.
π EXIT STATUS π
the following exit values are returned:
0β successful completion. we love a happy ending π«Ά> 0β an error occurred in the parsing of one of the HTML or XML files. π
π§ ENVIRONMENT π§
to use a proxy to retrieve remote files, set the environment variables http_proxy or ftp_proxy. e.g.:
http_proxy="http://localhost:8080/"
go through the proxy, babe, it's fine π
π BUGS π
okay so, real talk, some caveats:
- she assumes UTF-8 as input. and she doesn't expand character entities. instead, pipe the input through
hxunent(1)andasc2xml(1)to convert it to UTF-8. do the pipeline, bestie, it's giving teamwork β¨ hxaddidtries first to generate "readable" IDs by forming the ID out of the letters and digits found in the content of the element, and falls back to generating arbitrary IDs if it doesn't find enough. however, the algorithm in this version is primitive and only gives reasonable results for ASCII letters and digits. so like, don't expect miracles for the fancy stuff π- remote files (specified with a URL) are currently only supported for HTTP. password-protected files or files that depend on HTTP "cookies" are not handled. (you can use tools such as
curl(1)orwget(1)to retrieve such files.) we're not doing auth, we're just a girl π
π₯ SEE ALSO π₯
asc2xml(1), hxprune(1), hxnormalize(1), hxnum(1), hxtoc(1), hxunent(1), xml2asc(1), UTF-8 (RFC 2279)
and that's the whole page, periodt β¨ this one's from the HTML-XML-utils collection, version 7.x, dated 10 Jul 2011. old but she still slays ππ¦πΈ
π¦ where this page comes from
- alpine 3.24: html-xml-utils-doc 8.7-r0 Β· W3C
- arch rolling: html-xml-utils 8.8-1 Β· W3C
- debian bookworm: html-xml-utils 7.7-1.1 Β· W3C
- debian trixie: html-xml-utils 7.7-1.1+b1 Β· W3C
- fedora 43: html-xml-utils 8.6-2.fc41 Β· W3C AND BSD-3-Clause
- fedora 44: html-xml-utils 8.7-1.fc44 Β· W3C AND BSD-3-Clause
- nixos 26.05: html-xml-utils 8.7
- nixpkgs unstable: html-xml-utils 8.7
- opensuse-leap 16.0: html-xml-utils 8.6-bp160.1.12 Β· W3C
- opensuse-leap 16.0: html-xml-utils 8.6-bp160.1.12 Β· W3C
- opensuse-leap 16.0: html-xml-utils 8.6-bp160.1.12 Β· W3C
- opensuse-leap 16.0: html-xml-utils 8.6-bp160.1.12 Β· W3C
- ubuntu jammy: html-xml-utils 7.7-1.1 Β· W3C
- ubuntu noble: html-xml-utils 7.7-1.1build2 Β· W3C
- ubuntu questing: html-xml-utils 7.7-1.1build2
- ubuntu resolute: html-xml-utils 7.7-1.3 Β· W3C
- ubuntu stonking: html-xml-utils 7.7-1.3 Β· W3C
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms