About this project
mq is a command-line tool for processing Markdown with a query syntax modeled on jq. Written in Rust, it lets users slice, filter, map and transform Markdown documents, and it also accepts many other input and output formats.
Typical uses described by the project include preparing and manipulating Markdown for LLM prompts and outputs, generating structured Markdown for LLM consumption, managing documentation across files, extracting sections or patterns from documents, and applying consistent batch transformations.
Core capabilities:
- Selectors and built-in functions for slicing, filtering, mapping and transforming Markdown content.
- CLI with options for aggregation, streaming large files, watching files for changes, evaluating across all inputs, and controlling output.
- Input formats include markdown, mdx, html, text, null, raw, bytes, cbor, csv, gron, json, psv, toml, toon, tsv, xml and yaml; output formats include markdown, html, text, json, table, grep, gron, raw, csv, toml, toon, xml, yaml, shell and none.
- Update mode that writes transformed Markdown nodes to stdout, plus a diff mode that prints a unified diff and exits 1 when changes would occur.
- REPL for interactive query execution, a formatter, a static-analysis linter, a type checker, and an experimental debugger (mq-dbg) with Debug Adapter Protocol support.
- Language Server Protocol implementation and editor integrations for VS Code, Neovim, Zed, JetBrains IDEs, Obsidian, Helix and Chrome, plus a GitHub Action for CI.
- External subcommands via executables named mq- placed in ~/.local/bin/.
- Sandboxed permissions: network, filesystem read/write, command execution and environment access are disabled by default and can be granted individually or through presets (strict, read-only, networked, unsafe). HTTP module imports are also opt-in, with domain allowlists, caching, lockfile integrity checks and a frozen mode for CI.
Distribution and packaging:
- Install script, Homebrew, Arch (yay), Cargo (mq-run), Docker image, binstall and pre-built binaries for macOS, Linux and Windows.
- A Rust and TypeScript monorepo with crates such as mq-run, mq-lang, mq-markdown, mq-lsp, mq-repl, mq-formatter, mq-lint, mq-check, mq-hir, mq-dap, mq-crawler, mq-web-api, mq-macros, mq-test, mq-ffi and mq-wasm, plus npm packages mq-web and mq-nodejs.
- A hosted REST API and a browser playground; language bindings for Elixir, Python, Ruby, Java and Go.
Documentation is provided through a website, an online book, a cookbook of task-oriented recipes and an example guide. The project states it is under active development and is MIT licensed.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.