Repolode
harehare

harehare/mq

A jq-like command-line tool and query language for slicing, filtering and transforming Markdown files.

Stars
1,065
Forks
24
Open issues
11
Last commit
3 hours ago

What is it?

mq lets you query and transform Markdown the way jq handles JSON. You select parts of a document such as headings, code blocks, links, tables and sections with short expressions, then filter, map or rewrite them from the command line. It is written in Rust and ships with a REPL, a language server for editors, and a debugger.

Beyond Markdown, mq can read several other input formats, including HTML, CSV, JSON, YAML, TOML and XML, and convert them into Markdown tables or other outputs. Queries can be reused as modules, and external subcommands named mq-* can be added to the CLI. Sandbox flags control whether queries may read or write files, make network requests, or run commands.

The project provides bindings for Node.js, WebAssembly, C and several other languages, along with editor extensions for VS Code, Neovim, Zed and JetBrains IDEs.

Key features

  • 01Selects headings, code blocks, links, tables and sections with jq-style expressions.
  • 02Filters and maps Markdown content through built-in functions and selectors.
  • 03Reads HTML, CSV, JSON, YAML, TOML and XML as input and outputs multiple formats.
  • 04Includes an interactive REPL, a language server and an experimental debugger.
  • 05Runs queries under opt-in sandbox permissions for file, network and command access.

Use cases

  • Extracting specific sections or code snippets from large documentation sets.
  • Preparing or cleaning Markdown prompts and outputs for LLM workflows.
  • Batch-applying the same edit across many Markdown files in a repository.
  • Converting CSV or other data files into Markdown tables from a script or CI job.

Quick start

  1. 1

    Install via Homebrew (macOS/Linux)

    brew install mq
  2. 2

    Run a query on a Markdown file to extract code blocks

    mq '.code' README.md

Things to know

  • The project is under active development and may change.

Topics

FAQ

What is mq?
A jq-like command-line tool and query language for slicing, filtering and transforming Markdown files. mq lets you query and transform Markdown the way jq handles JSON. You select parts of a document such as headings, code blocks, links, tables and sections with short expressions, then filter, map or rewrite them from the command line. It is written in Rust and ships with a REPL, a language server for editors, and a debugger.
Is mq free to use? What license does it have?
mq is open source under the MIT license. Check the license terms before using it in commercial products.
Is mq still maintained?
Actively maintained. The last commit to mq was on Oct 22, 2026.
What can I use mq for?
Extracting specific sections or code snippets from large documentation sets. Preparing or cleaning Markdown prompts and outputs for LLM workflows. Batch-applying the same edit across many Markdown files in a repository. Converting CSV or other data files into Markdown tables from a script or CI job.
How do I install mq?
Install via Homebrew (macOS/Linux): brew install mq Run a query on a Markdown file to extract code blocks: mq '.code' README.md
Where can I get mq?
The source code and installation instructions are on GitHub: https://github.com/harehare/mq

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects