$git clone https://github.com/harehare/mqQuery. Filter. Transform Markdown.
| 1 | <div align="center"> |
| 2 | <img src="assets/logo.svg" style="width: 128px; height: 128px;"/> |
| 3 | |
| 4 | <a href="https://mqlang.org">Visit the site 🌐</a> |
| 5 | — |
| 6 | <a href="https://mqlang.org/book">Read the book 📖</a> |
| 7 | — |
| 8 | <a href="https://mqlang.org/playground">Playground 🎮</a> |
| 9 | |
| 10 | <h1>mq</h1> |
| 11 | |
| 12 | **Query. Filter. Transform Markdown.** |
| 13 | |
| 14 | [](https://github.com/harehare/mq/actions/workflows/ci.yml) |
| 15 | [](https://github.com/harehare/mq/actions/workflows/audit.yml) |
| 16 | [](https://crates.io/crates/mq-markdown) |
| 17 | [](https://codecov.io/gh/harehare/mq) |
| 18 | [](https://codspeed.io/harehare/mq) |
| 19 | [](LICENSE) |
| 20 | |
| 21 | mq is a command-line tool that processes Markdown using a syntax similar to jq. |
| 22 | |
| 23 | It's written in Rust, allowing you to easily slice, filter, map, and transform structured data. |
| 24 | |
| 25 | </div> |
| 26 | |
| 27 |  |
| 28 | |
| 29 | > [!IMPORTANT] |
| 30 | > This project is under active development. |
| 31 | |
| 32 | ## Why mq? |
| 33 | |
| 34 | mq makes working with Markdown files as easy as jq makes working with JSON. It's especially useful for: |
| 35 | |
| 36 | - **LLM Workflows**: Efficiently manipulate and process Markdown used in LLM prompts and outputs |
| 37 | - **LLM Input Generation**: Generate structured Markdown content optimized for LLM consumption, since Markdown serves as the primary input format for most language models |
| 38 | - **Documentation Management**: Extract, transform, and organize content across multiple documentation files |
| 39 | - **Content Analysis**: Quickly extract specific sections or patterns from Markdown documents |
| 40 | - **Batch Processing**: Apply consistent transformations across multiple Markdown files |
| 41 | |
| 42 | Since LLM inputs are primarily in Markdown format, mq provides efficient tools for generating and processing the structured Markdown content that LLMs require. |
| 43 | |
| 44 | ## Features |
| 45 | |
| 46 | - **Slice and Filter**: Extract specific parts of your Markdown documents with ease. |
| 47 | - **Map and Transform**: Apply transformations to your Markdown content. |
| 48 | - **Command-line Interface**: Simple and intuitive CLI for quick operations. |
| 49 | - **Extensibility**: Easily extendable with custom functions. |
| 50 | - **Built-in support**: Filter and transform content with many built-in functions and selectors. |
| 51 | - **REPL Support**: Interactive command-line REPL for testing and experimenting. |
| 52 | - **IDE Support**: VSCode Extension and Language Server **Protocol** (LSP) support for custom function development. |
| 53 | - **Debugger**: Includes an experimental debugger (`mq-dbg`) for inspecting and stepping through mq queries interactively. |
| 54 | - **External Subcommands**: Extend mq with custom subcommands by placing executable files starting with `mq-` in `~/.local/bin/`. |
| 55 | |
| 56 | ## Installation |
| 57 | |
| 58 | ### Quick Install |
| 59 | |
| 60 | ```bash |
| 61 | curl -sSL https://mqlang.org/install.sh | bash |
| 62 | ``` |
| 63 | |
| 64 | The installer will: |
| 65 | |
| 66 | - Download the latest mq binary for your platform |
| 67 | - Install it to `~/.local/bin/` |
| 68 | - Update your shell profile to add mq to your PATH |
| 69 | |
| 70 | ### Cargo |
| 71 | |
| 72 | ```sh |
| 73 | # Install from crates.io |
| 74 | cargo install mq-run |
| 75 | # Install from Github |
| 76 | cargo install --git https://github.com/harehare/mq.git mq-run --tag v0.7.0 |
| 77 | # Latest Development Version |
| 78 | cargo install --git https://github.com/harehare/mq.git mq-run --bin mq |
| 79 | # Install the debugger |
| 80 | cargo install --git https://github.com/harehare/mq.git mq-run --bin mq-dbg --features="debugger" |
| 81 | # Install using binstall |
| 82 | cargo binstall mq-run@0.7.0 |
| 83 | ``` |
| 84 | |
| 85 | ### Binaries |
| 86 | |
| 87 | You can download pre-built binaries from the [GitHub releases page](https://github.com/harehare/mq/releases): |
| 88 | |
| 89 | ```sh |
| 90 | # macOS (Apple Silicon) |
| 91 | cur |