# Query a Markdown Document

Paste Markdown and pull out its headings, links, images, code blocks, or tables as plain text, JSON, or clean Markdown. Runs in your browser, nothing uploaded, free.

## Run it

- **CLI:** `gizza tool markdown-query '# Title

See the [docs](https://example.com "Docs") and the ![logo](logo.png).

```rust
let x = 1;
```

| a | b |
|---|---|
| 1 | 2 |'`
- **Web:** https://gizza.ai/tools/markdown-query/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/markdown-query/tool.json

## Inputs

- `markdown` — Markdown _(field)_
- `extract` — Extract _(field)_
- `format` — Output format _(field)_
- `include_line_numbers` — Include source line numbers _(field)_

## Output

- Result (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `markdown` — Markdown
- `extract` — Extract
- `format` — Output format
- `include_line_numbers` — Include source line numbers

Example: `https://gizza.ai/tools/markdown-query/?markdown=%23%20Title%0A%0ASee%20the%20%5Bdocs%5D%28https%3A%2F%2Fexample.com%20%22Docs%22%29%20and%20the%20%21%5Blogo%5D%28logo.png%29.%0A%0A%60%60%60rust%0Alet%20x%20%3D%201%3B%0A%60%60%60%0A%0A%7C%20a%20%7C%20b%20%7C%0A%7C---%7C---%7C%0A%7C%201%20%7C%202%20%7C&extract=headings&format=text&include_line_numbers=true`

---

## About this tool

Markdown Query is a small "jq for Markdown": paste a Markdown document, choose
what you want, and get just those pieces back. Pick an element type — **headings**,
**links**, **images**, **code blocks**, or **tables** — and the tool parses the
document and pulls out every match. It understands standard CommonMark plus
GitHub-flavored pipe tables, so inline and reference links, autolinks, fenced code
with a language tag, and multi-column tables all come through correctly.

Choose how the results come out: **Text** for a quick human-readable list, **JSON**
for a structured `{ count, items }` payload you can feed to a script, or **Markdown**
to get clean, reconstructed snippets you can paste elsewhere. Turn on **source line
numbers** to see exactly where each item lives in the original document — handy for
linting docs, auditing links, or building a table of contents.

Everything runs locally in your browser through a WebAssembly parser. Your Markdown
is never uploaded, there is no sign-up, and the output is fully deterministic — the
same input always produces the same result.

## FAQ

<details>
<summary>What can I extract from my Markdown?</summary>

Five element types: **headings** (with their level), **links** (text plus the
destination URL and any title), **images** (alt text plus the source URL),
**code blocks** (the code plus its language, if the fence has one), and **tables**
(the header row plus every body row). Pick one at a time from the *Extract* control.

</details>

<details>
<summary>What is the difference between the Text, JSON, and Markdown formats?</summary>

**Text** gives a compact, human-readable listing — one item per line, with code and
tables shown as blocks. **JSON** returns a structured object with a `count` and an
array of items, ideal for scripting. **Markdown** rebuilds each match as valid
Markdown (for example `[text](url)` for links or a fenced block for code) so you can
paste it straight into another document.

</details>

<details>
<summary>Does it handle tables and fenced code blocks?</summary>

Yes. Tables use GitHub-flavored pipe syntax, and column alignment is preserved when
you export back to Markdown. Fenced code blocks keep their language tag (` ```rust `),
and indented code blocks are captured too — they just report an empty language.

</details>

<details>
<summary>What do the source line numbers show?</summary>

When **Include source line numbers** is on, each item is annotated with the 1-based
line in your original Markdown where it begins. In JSON output this appears as a
`line` field; in text and Markdown output it is shown as a small prefix or comment.
It is useful for linting, auditing links, or jumping back to the source.

</details>

<details>
<summary>Is my Markdown uploaded anywhere?</summary>

No. The parser is compiled to WebAssembly and runs entirely in your browser. Nothing
is sent to a server, there is no sign-up, and the same input always yields the same
output.

</details>

## Related tools

- [BibTeX Formatter & Validator](https://gizza.ai/tools/bibtex-format/): Free BibTeX formatter and validator — pretty-print, sort and align .bib bibliography entries in your browser. Consistent indentation, no sign-up, no upload.
- [Citation Generator](https://gizza.ai/tools/citation-generator/): Free APA 7, MLA 9, Chicago and Harvard citation generator — format author, title, year, journal and URL into a correct reference right in your browser.
- [Document Splitter](https://gizza.ai/tools/document-splitter/): Split a long Markdown or HTML document into separate files, one per top-level heading. Runs entirely in your browser, no upload, no sign-up.
- [ENEX to Markdown Converter](https://gizza.ai/tools/enex-to-markdown/): Convert Evernote ENEX exports to Markdown or plain text with titles, dates, tags, source URLs, and attachment summaries — locally in your browser.
- [HTML to Markdown](https://gizza.ai/tools/html-to-markdown/): Convert HTML into clean Markdown instantly in your browser — preserves headings, links, lists, code blocks, tables, and emphasis. Free, private, no upload, no sign-up.
