PitchHut logo
A jq-like command-line tool for efficient markdown processing.
Pitch

MQ is a powerful command-line tool designed for markdown processing, offering a jq-like interface. It simplifies the workflow for developers and writers dealing with markdown, ensuring fast and efficient document manipulation. Whether it's formatting, parsing, or transforming markdown files, MQ enhances productivity through its intuitive command-line features.

Description

mq is a powerful command-line tool designed for processing Markdown files, utilizing a syntax reminiscent of jq. Developed in Rust, it allows for efficient slicing, filtering, mapping, and transforming of structured data. With an intuitive command-line interface, mq empowers users to manipulate and analyze Markdown content seamlessly.

Key Benefits of mq

  • LLM Workflows: Streamline the manipulation of Markdown used in prompts and outputs for language models.
  • LLM Input Generation: Generate well-structured Markdown optimized for LLM consumption, the primary format for most language models.
  • Documentation Management: Efficiently extract, transform, and organize content from multiple Markdown files.
  • Content Analysis: Quickly retrieve specific sections or patterns within Markdown documents.
  • Batch Processing: Consistently apply transformations across several Markdown files.

Given that most LLM inputs are in Markdown format, mq equips users with the tools needed to generate and process the structured content essential for language models.

Impressive Features

  • Slice and Filter: Extract specific elements from Markdown documents with ease.
  • Map and Transform: Apply transformations to Markdown content effectively.
  • Command-line Interface: A straightforward CLI facilitates rapid operations.
  • Extensibility: Custom functions can be easily integrated to enhance functionality.
  • Built-in Functions: Utilize numerous in-built functions and selectors for filtering and transformation.
  • REPL Support: An interactive command-line REPL allows for immediate testing and experimentation.
  • IDE Compatibility: Supports Visual Studio Code extensions and Language Server Protocol (LSP) for developing custom functions.
  • Debugger: Offers an experimental debugger (mq-dbg) for hands-on inspection and step-through of queries.
  • External Subcommands: Enhance mq with custom subcommands by placing executable files prefixed with mq- in the ~/.mq/bin/ directory.

Usage Examples

To perform simple tasks with mq, refer to the following examples:

# Extract all headings from a Markdown document
mq '.h' README.md

# Get code blocks containing "name"
mq '.code | select(contains("name"))' example.md

# Extract URLs from links in a document
mq '.link.url' README.md

For more comprehensive usage scenarios and options, please consult the full documentation. Additionally, a collection of practical examples can be found in the Example Guide.

External Tools

mq can be augmented further by integrating with several external tools, including:

  • mq-mcp: Implementation of the Model Context Protocol (MCP) for AI assistants.
  • mq-view: A specialized viewer for Markdown content.
  • mq-tui: An interactive Terminal User Interface (TUI) for handling mq queries.
  • mq-task: A task runner leveraging mq to define tasks in Markdown format.
0 comments

No comments yet.

Sign in to be the first to comment.