mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-07-30 20:55:36 +02:00
htmlq: add page (#15625)
Co-authored-by: Wiktor Perskawiec <git@spageektti.cc> Co-authored-by: Juri Dispan <juri.dispan@posteo.net> Co-authored-by: Managor <42655600+Managor@users.noreply.github.com>
This commit is contained in:
parent
4f7c596fd6
commit
549ba9c42f
1 changed files with 24 additions and 0 deletions
24
pages/common/htmlq.md
Normal file
24
pages/common/htmlq.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
# htmlq
|
||||
|
||||
> Use CSS selectors to extract content from HTML files.
|
||||
> More information: <https://github.com/mgdm/htmlq>.
|
||||
|
||||
- Return all elements of class `card`:
|
||||
|
||||
`cat {{path/to/file.html}} | htmlq '.card'`
|
||||
|
||||
- Get the text content of the first paragraph:
|
||||
|
||||
`cat {{path/to/file.html}} | htmlq --text 'p:first-of-type'`
|
||||
|
||||
- Find all the links in a page:
|
||||
|
||||
`cat {{path/to/file.html}} | htmlq --attribute href 'a'`
|
||||
|
||||
- Remove all images and SVGs from a page:
|
||||
|
||||
`cat {{path/to/file.html}} | htmlq --remove-nodes 'img' --remove-nodes 'svg'`
|
||||
|
||||
- Pretty print and write the output to a file:
|
||||
|
||||
`htmlq --pretty --filename {{path/to/input.html}} --output {{path/to/output.html}}`
|
Loading…
Add table
Reference in a new issue