Skip to content

mq

A jq-like Markdown query language for command-line processing

Install

$cargo install --git https://github.com/harehare/mq.git mq-run --tag v0.9.3

Install command taken from the project's README or registry entry. Always review code before running it.

Visit the site 🌐 — Read the book 📖 — Playground 🎮

mq

Query. Filter. Transform Markdown.

mq is a command-line tool that processes Markdown using a syntax similar to jq.

It's written in Rust, allowing you to easily slice, filter, map, and transform structured data.

[!IMPORTANT] This project is under active development.

Why mq?

mq makes working with Markdown files as easy as jq makes working with JSON. It's especially useful for:

  • LLM Workflows: Efficiently manipulate and process Markdown used in LLM prompts and outputs
  • LLM Input Generation: Generate structured Markdown content optimized for LLM consumption, since Markdown serves as the primary input format for most language models
  • Documentation Management: Extract, transform, and organize content across multiple documentation files
  • Content Analysis: Quickly extract specific sections or patterns from Markdown documents
  • Batch Processing: Apply consistent transformations across multiple Markdown files

Since LLM inputs are primarily in Markdown format, mq provides efficient tools for generating and processing the structured Markdown content that LLMs require.

Features

  • Slice and Filter: Extract specific parts of your Markdown documents with ease.
  • Map and Transform: Apply transformations to your Markdown content.
  • Command-line Interface: Simple and intuitive CLI for quick operations.
  • Extensibility: Easily extendable with custom functions.
  • Built-in support: Filter and transform content with many built-in functions and selectors.
  • REPL Support: Interactive command-line REPL for testing and experimenting.
  • IDE Support: VSCode Extension and Language Server Protocol (LSP) support for custom function development.
  • Debugger: Includes an experimental debugger (mq-dbg) for inspecting and stepping through mq queries interactively.
  • External Subcommands: Extend mq with custom subcommands by placing executable files starting with mq- in ~/.local/bin/.

Installation

Quick Install

curl -sSL https://mqlang.org/install.sh | bash

Downloads the latest mq binary for your platform, installs it to ~/.local/bin/, and updates your shell profile to add mq to your PATH.

Package Managers

Method Command
Homebrew (macOS/Linux) brew install mq
MacPorts (macOS) sudo port 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.9.3
# 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 mq-run@0.9.3

Pre-built binaries for macOS, Linux, and Windows are also available on the GitHub releases page.

Editor & CI Integrations

Similar plugs

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

One portable memory layer for every AI agent: local-first, Markdown-native, user-owned, and self-evolving across apps, tools, and workflows.

Explore related