@@ -19,12 +19,12 @@ brew install htmlq
1919
2020``` console
2121$ htmlq -h
22- htmlq 0.3 .0
22+ htmlq 0.4 .0
2323Michael Maclean <[email protected] > 2424Runs CSS selectors on HTML
2525
2626USAGE:
27- htmlq [FLAGS] [OPTIONS] [selector]...
27+ htmlq [FLAGS] [OPTIONS] [--] [ selector]...
2828
2929FLAGS:
3030 -B, --detect-base Try to detect the base URL from the <base> tag in the document. If not found, default to
@@ -36,10 +36,12 @@ FLAGS:
3636 -V, --version Prints version information
3737
3838OPTIONS:
39- -a, --attribute <attribute> Only return this attribute (if present) from selected elements
40- -b, --base <base> Use this URL as the base for links
41- -f, --filename <FILE> The input file. Defaults to stdin
42- -o, --output <FILE> The output file. Defaults to stdout
39+ -a, --attribute <attribute> Only return this attribute (if present) from selected elements
40+ -b, --base <base> Use this URL as the base for links
41+ -f, --filename <FILE> The input file. Defaults to stdin
42+ -o, --output <FILE> The output file. Defaults to stdout
43+ -r, --remove-nodes <SELECTOR>... Remove nodes matching this expression before output. May be specified multiple
44+ times
4345
4446ARGS:
4547 <selector>... The CSS expression to select [default: html]
@@ -107,6 +109,44 @@ to change that. NixOS has many innovative features:
107109[...]
108110```
109111
112+ ### Remove a node before output
113+
114+ There's a big SVG image in this page that I don't need, so here's how to remove it.
115+
116+ ``` console
117+ $ curl --silent https://nixos.org/ | ./target/debug/htmlq ' .whynix' --remove-nodes svg
118+ <ul class="whynix">
119+ <li>
120+
121+ <h2>Reproducible</h2>
122+ <p>
123+ Nix builds packages in isolation from each other. This ensures that they
124+ are reproducible and don't have undeclared dependencies, so <strong>if a
125+ package works on one machine, it will also work on another</strong>.
126+ </p>
127+ </li>
128+ <li>
129+
130+ <h2>Declarative</h2>
131+ <p>
132+ Nix makes it <strong>trivial to share development and build
133+ environments</strong> for your projects, regardless of what programming
134+ languages and tools you’re using.
135+ </p>
136+ </li>
137+ <li>
138+
139+ <h2>Reliable</h2>
140+ <p>
141+ Nix ensures that installing or upgrading one package <strong>cannot
142+ break other packages</strong>. It allows you to <strong>roll back to
143+ previous versions</strong>, and ensures that no package is in an
144+ inconsistent state during an upgrade.
145+ </p>
146+ </li>
147+ </ul>
148+ ```
149+
110150### Pretty print HTML
111151
112152(This is a bit of a work in progress)
0 commit comments