2025-12-16 10:20:31 -07:00
|
|
|
# htmlq
|
|
|
|
|
|
|
|
|
|
> Gunakan selektor CSS untuk mengekstrak konten dari berkas-berkas HTML.
|
2026-02-18 06:55:01 -07:00
|
|
|
> Informasi lebih lanjut: <https://github.com/mgdm/htmlq#usage>.
|
2025-12-16 10:20:31 -07:00
|
|
|
|
|
|
|
|
- Dapatkan seluruh elemen HTML yang memuat class `card`:
|
|
|
|
|
|
|
|
|
|
`cat {{jalan/menuju/berkas.html}} | htmlq '.card'`
|
|
|
|
|
|
|
|
|
|
- Dapatkan konten teks dari paragraf pertama:
|
|
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`cat {{jalan/menuju/berkas.html}} | htmlq {{[-t|--text]}} 'p:first-of-type'`
|
2025-12-16 10:20:31 -07:00
|
|
|
|
|
|
|
|
- Tampilkan seluruh tautan dalam suatu laman:
|
|
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`cat {{jalan/menuju/berkas.html}} | htmlq {{[-a|--attribute]}} href 'a'`
|
2025-12-16 10:20:31 -07:00
|
|
|
|
|
|
|
|
- Hapus seluruh gambar dan elemen SVG dari suatu laman:
|
|
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`cat {{jalan/menuju/berkas.html}} | htmlq {{[-r|--remove-nodes]}} 'img' {{[-r|--remove-nodes]}} 'svg'`
|
2025-12-16 10:20:31 -07:00
|
|
|
|
|
|
|
|
- Simpan laman input secara cetak-cantik menuju suatu berkas output:
|
|
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`htmlq {{[-p|--pretty]}} {{[-f|--filename]}} {{jalan/menuju/input.html}} {{[-o|--output]}} {{jalan/menuju/output.html}}`
|