Skip to content

harehare/mq_elixir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mq_elixir

Elixir bindings for mq, a jq-like command-line tool for Markdown processing.

Features

  • Process markdown, MDX, HTML, and plain text
  • Full mq query language support
  • Multiple input and output format options
  • Configurable rendering options
  • Fast Rust-powered NIF implementation

Installation

Add mq to your list of dependencies in mix.exs:

def deps do
  [
    {:mq_elixir, "~> 0.1.0"}
  ]
end

Usage

Basic Query

# Extract all H1 headings
{:ok, result} = Mq.run(".h1", "# Hello\n## World")
IO.inspect(result.values)  # ["# Hello"]

Working with Results

{:ok, result} = Mq.run(".h", "# H1\n## H2\n### H3")

# Access values
result.values  # ["# H1", "## H2", "### H3"]
result.text    # "# H1\n## H2\n### H3"

# Enumerate
Enum.each(result, fn heading -> IO.puts(heading) end)

Documentation

Full documentation is available on HexDocs.

For mq query language syntax, see the official mq documentation.

License

MIT License

About

Elixir bindings for mq, a jq-like command-line tool for processing Markdown.

Topics

Resources

License

Stars

Watchers

Forks

Contributors