A jq-like Markdown query language for command-line processing
A jq-like Markdown query language for command-line processing
[!IMPORTANT] This project is under active development.
mq makes working with Markdown files as easy as jq makes working with JSON. It's especially useful for:
Since LLM inputs are primarily in Markdown format, mq provides efficient tools for generating and processing the structured Markdown content that LLMs require.
mq-dbg) for inspecting and stepping through mq queries interactively.mq- in ~/.local/bin/.curl -sSL https://mqlang.org/install.sh | bashDownloads the latest mq binary for your platform, installs it to ~/.local/bin/, and updates your shell profile to add mq to your PATH.
| Method | Command |
|---|---|
| Homebrew (macOS/Linux) | brew install mq |
| Arch (yay) | yay -S mq-bin |
| Cargo (crates.io) | cargo install mq-run |
| Docker | docker run --rm ghcr.io/harehare/mq:latest |
More install options: cargo variants, binstall, pre-built binaries
# Install from Github
cargo install --git https://github.com/harehare/mq.git mq-run --tag v0.8.5
# Latest Development Version
cargo install --git https://github.com/harehare/mq.git mq-run --bin mq
# Install the debugger
cargo install --git https://github.com/harehare/mq.git mq-run --bin mq-dbg --features="debugger"
# Install using binstall
cargo binstall [email protected]Pre-built binaries for macOS, Linux, and Windows are also available on the GitHub releases page.
| Integration | Link |
|---|---|
| VS Code | |
| Chrome | |
| Neovim | |
| Zed | |
| JetBrains IDEs | |
| Obsidian | |
| Helix | |
| GitHub Actions |
steps:
- uses: actions/checkout@v7
- uses: harehare/setup-mq@v1
- run: mq '.code' README.mdmq is a Rust + TypeScript monorepo.
Rust crates and npm packages (click to show)
| Name | Description | Version |
|---|---|---|
mq-run |
Command-line interface for mq | |
mq-lang |
Core language implementation | |
mq-markdown |
Markdown parsing and manipulation utilities | |
mq-lsp |
Language Server Protocol implementation | |
mq-repl |
Interactive REPL | |
mq-formatter |
Code formatter for the mq query language | |
mq-lint |
Static analysis linter | |
mq-check |
Type checker | |
mq-hir |
High-level Internal Representation (HIR) | |
mq-dap |
Debug Adapter Protocol implementation | |
mq-crawler |
Directory crawler for batch Markdown processing | |
mq-web-api |
HTTP/REST server exposing mq queries over the network | |
mq-macros |
Procedural macros for builtin function registration | |
mq-test |
Test runner for mq | |
mq-ffi |
C API for integrating mq into C applications | — |
mq-wasm |
WebAssembly bindings | — |
mq-web |
Official WebAssembly build for the browser | |
mq-nodejs |
Node.js bindings |
mq is also available as a hosted REST API (see mq-web-api above). See the REST API docs or try it in the Playground.
curl --data-binary @doc.md https://api.mqlang.org/.h1Language bindings are available for Elixir, Python, Ruby, Java, and Go. See the Language Bindings documentation for details.
For more detailed usage and examples, refer to the documentation.
Looking for a solution to a specific problem? See the Cookbook for task-first recipes, or the Example Guide for a full tour of mq's selectors and built-in functions.
Complete list of options (click to show)
…Here's a basic example of how to use mq:
…mq subcommands are designed to work together via Unix pipes.
# Convert Excel report to Markdown, then extract all headings
mq conv report.xlsx | mq '.h'
# Convert a Word document and extract a specific section
mq conv document.docx | mq -A 'section::section("Summary")'
# Convert and view Markdown directly in the terminal
mq conv slides.pdf | mq viewRun mq --list to see all available subcommands (built-in and external).
You can extend mq with custom subcommands by placing executable files starting with mq- in ~/.local/bin/ or anywhere in your PATH.
This makes it easy to add your own tools and workflows to mq without modifying the core binary.
See the External Subcommands documentation for the full list and details.
Contributions are welcome! See CONTRIBUTING.md for development setup, coding conventions, and how to submit changes. Please also review our Code of Conduct.
This project is licensed under the MIT License. See the LICENSE file for details.
No open issues yet, or sync has not completed.