1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-15 21:15:33 +02:00
tldr/pages/common/pup.md
Managor d1fa35edf6
common/*: reduce usage of "command-line" (part 2) (#16950)
Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>
2025-06-29 11:47:23 +03:00

604 B

pup

HTML parsing tool. More information: https://github.com/ericchiang/pup.

  • Transform a raw HTML file into a cleaned, indented, and colored format:

cat {{index.html}} | pup --color

  • Filter HTML by element tag name:

cat {{index.html}} | pup '{{tag}}'

  • Filter HTML by ID:

cat {{index.html}} | pup '{{div#id}}'

  • Filter HTML by attribute value:

cat {{index.html}} | pup '{{input[type="text"]}}'

  • Print all text from the filtered HTML elements and their children:

cat {{index.html}} | pup '{{div}} text{}'

  • Print HTML as JSON:

cat {{index.html}} | pup '{{div}} json{}'