@@ -49,9 +49,9 @@ Any of these will work:
4949
5050> [ !Tip]
5151> - These binaries are all built on GitHub's servers, so if you trust my code (and dependencies), and you trust GitHub,
52- > you can trust the binaries.
53- >
54- > See [ the wiki page on release binaries] for information on how to verify them.
52+ > you can trust the binaries.
53+ >
54+ > See [ the wiki page on release binaries] for information on how to verify them.
5555> - You'll have to ` chmod +x ` them before you can run them.
5656
5757[ the wiki page on release binaries ] : https://github.com/yshavit/mdq/wiki/Release-binaries
@@ -62,83 +62,47 @@ Any of these will work:
6262
6363# Basic Usage
6464
65- ``` shell
66- # Select sections containing "usage":
67- $ cat example.md | mdq ' # usage'
68-
69- # Select sections containing "usage", and within those find all unordered list items:
70- $ cat example.md | mdq ' # usage | -'
65+ Simple example to select sections containing "usage":
7166
72- # ... or maybe you only want the list items containing "note":
73- $ cat example.md | mdq ' # usage | - note '
67+ ``` shell
68+ cat example.md | mdq ' # usage'
7469```
7570
76- You can select...
77-
78- - Sections:
79-
80- ``` bash
81- $ cat example.md | mdq ' # foo' # find headers whose title contains "foo"
82- ```
83-
84- - Lists and tasks:
85-
86- ``` bash
87- $ cat example.md | mdq ' - foo' # find unordered list items containing "foo"
88- $ cat example.md | mdq ' 1. foo' # find ordered list items containing "foo"
89- # (note: the number must be exactly "1.")
90- $ cat example.md | mdq ' - [ ] foo' # find uncompleted task items containing "foo"
91- $ cat example.md | mdq ' - [x] foo' # find completed task items containing "foo"
92- $ cat example.md | mdq ' - [?] foo' # find all task items containing "foo"
93- ```
94-
95- - Links and images:
96-
97- ``` bash
98- $ cat example.md | mdq ' [foo](bar)' # find links with display text containing "foo"
99- # and URL containing "bar"
100- $ cat example.md | mdq ' ' # ditto for images
101- ```
102-
103- - Block quotes:
71+ Use pipe (` | ` ) to chain filters together. For example, to select sections containing "usage", and within those find
72+ all unordered list items:
10473
105- ``` bash
106- $ cat example.md | mdq ' > foo' # find block quotes containing "foo"
107- ```
108-
109- - Code blocks:
110-
111- ``` bash
112- $ cat example.md | mdq ' ```rust fizz' # find code blocks for rust with "fizz" within them
113- ```
114-
115- - HTML (inline or block):
116-
117- ``` bash
118- $ cat example.md | mdq ' </> foo' # find html tags containing "foo"
119- ```
120-
121- - Paragraphs
122-
123- ``` bash
124- $ cat example.md | mdq ' P: foo' # find paragraphs containing "foo"
125- ```
126-
127- - Tables
128-
129- ``` bash
130- $ cat example.md | mdq ' :-: "some headers" :-: "some rows"'
131- ```
132- (Tables selection differs from other selections in that you can actually select only certain headers and rows.
133- See the wiki for more.)
134-
135- The ` foo ` s and ` bar ` s above can be:
74+ ``` shell
75+ cat example.md | mdq ' # usage | -'
76+ ```
13677
137- - an ` unquoted string ` that starts with a letter, as shown above
138- - a ` "quoted string" ` (either single or double quotes)
78+ The filter syntax is designed to mirror Markdown syntax. You can select...
79+
80+ | Element | Syntax |
81+ | ------------------| ----------------------------------|
82+ | Sections | ` # title text ` |
83+ | Lists | ` - unordered list item text ` |
84+ | " | ` 1. ordered list item text ` |
85+ | " | ` - [ ] uncompleted task ` |
86+ | " | ` - [x] completed task ` |
87+ | " | ` - [?] any task ` |
88+ | Links | ` [display text](url) ` |
89+ | Images | `  ` |
90+ | Block quotes | ` > block quote text ` |
91+ | Code blocks | ` ```language <code block text> ` |
92+ | Raw HTML | ` </> html_tag ` |
93+ | Plain paragraphs | ` P: paragraph text ` |
94+ | Tables | ` :-: header text :-: row text ` |
95+
96+ (Tables selection differs from other selections in that you can actually select only certain headers and rows, such that
97+ the resulting element is of a different shape than the original. See the wiki for more.)
98+
99+ In any of the above, the text may be:
100+
101+ - an ` unquoted string ` that starts with a letter; this is case-insensitive
102+ - a ` "quoted string" ` (either single or double quotes); this is case-sensitive
139103- a string (quoted or unquoted) anchored by ` ^ ` or ` $ ` (for start and end of string, respectively)
140104- a ` /regex/ `
141- - omitted, to mean "any"
105+ - omitted or ` * ` , to mean "any"
142106
143107See the [ tutorial] for a bit more detail, and [ user manual] for the full picture.
144108
0 commit comments