Loading...
Loading...
Processes Markdown files using mq, a jq-like query language for Markdown. Use when the user mentions Markdown processing, content extraction, document transformation, or mq queries.
npx skill4agent add harehare/mq processing-markdown| Selector | Description |
|---|---|
| All headings |
| Specific heading level |
| Text nodes |
| Code blocks |
| Inline code |
| Bold text |
| Italic text |
| Strikethrough |
| Links |
| Images |
| List items |
| Block quotes |
| Table cells |
| HTML nodes |
| Footnotes |
| Math blocks |
| Frontmatter |
.h.level # Heading level (1-6)
.h.depth # Same as .h.level
.code.lang # Code block language
.code.value # Code block content
.link.url # Link URL
.link.title # Link title
.image.url # Image URL
.image.alt # Image alt text
.list.index # List item index
.list.level # Nesting level
.list.ordered # Whether ordered list
.list.checked # Checkbox state
.[0][0].row # Table cell row
.[0][0].column # Table cell columnmq '.h' file.md # All headings
mq '.h1' file.md # Only h1 headings
mq '.code' file.md # All code blocks
mq '.link.url' file.md # All URLs
mq '.image.alt' file.md # All image alt textsmq 'select(.code)' file.md # Only code blocks
mq 'select(!.code)' file.md # Everything except code blocks
mq 'select(.h.level <= 2)' file.md # h1 and h2 only
mq 'select(.code.lang == "rust")' file.md # Rust code blocks only
mq 'select(contains("TODO"))' file.md # Nodes containing "TODO"mq '.h | to_text()' file.md # Headings as plain text
mq '.code | to_text()' file.md # Code block content as text
mq '.link | to_string()' file.md # Links as strings.h
| let link = to_link("#" + to_text(self), to_text(self), "")
| let level = .h.depth
| if (!is_none(level)): to_md_list(link, level - 1)mq -A 'pluck(.code.value)' *.md # Collect all code values
mq -S 's"\n---\n"' 'identity()' *.md # Merge files with separator| Flag | Purpose |
|---|---|
| Combine all inputs into single array |
| Input format: |
| Output format: |
| Update file in place |
| Load query from |
| Write to output file |
| Insert query result between files |
| Set runtime variable |
| Load file into variable |
| Process line by line |
| Load built-in modules |
| Colorize output |
| Parallel processing threshold |
catecho