https://github.com/harehare/mq
jq like Markdown processing tool
https://github.com/harehare/mq
cli jq markdown programming-language repl rust
Last synced: 10 months ago
JSON representation
jq like Markdown processing tool
- Host: GitHub
- URL: https://github.com/harehare/mq
- Owner: harehare
- License: mit
- Created: 2025-02-24T13:55:22.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-03-04T01:15:54.000Z (10 months ago)
- Last Synced: 2025-03-04T02:22:01.947Z (10 months ago)
- Topics: cli, jq, markdown, programming-language, repl, rust
- Language: Rust
- Homepage: https://harehare.github.io/mq/
- Size: 646 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mcp - mq - ⭐ 229 (📚 Projects (1974 total) / MCP Servers)
- awesome-mcp - harehare/mq - mq is a jq-like command-line tool for processing and transforming Markdown files, with features supporting LLM workflows and an MCP server implementation for AI assistant integration. (MCP Frameworks and libraries / Rust)
README
# `mq` - jq like tool for markdown processing
[](https://github.com/harehare/mq/actions/workflows/ci.yml)

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.
> ⚠️ This project is under active development and is not yet production-ready.
## 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
- **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
## 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.
## Installation
To install `mq`, you can use `cargo`:
```sh
cargo install --git https://github.com/harehare/mq.git mq-cli
# Installing from cargo is under preparation.
cargo install mq-cli
```
### Docker
```sh
$ docker run --rm ghcr.io/harehare/mq:0.1.0-preview
```
### Visual Studio Code Extension
You can install the VSCode extension from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=harehare.vscode-mq).
## Usage
Here's a basic example of how to use `mq`:
```sh
$ mq 'or(.[], .h) | select(contains("name"))'
$ mq '.code | select(contains("else"))'
```
### Advanced Usage
This example how to generate a table of contents (TOC) from a markdown file.
You can chain multiple operations to perform complex transformations:
```sh
$ mq 'select(or(.h1, .h2, .h3)) | let link = md_link(add($__FILE__, add("#", to_text(self))), to_text(self)) | if (is_h1()): md_list(link, 1) elif (is_h2()): md_list(link, 2) elif (is_h3()): md_list(link, 3) else: None' docs/book/*.md
```
For more detailed usage and examples, refer to the [documentation](https://harehare.github.io/mq/book/).
## Playground
An [Online Playground](https://harehare.github.io/mq/playground) is available, powered by WebAssembly.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.