Project

mq-ruby

0.0
No release in over 3 years
mq is a jq-like command-line tool for Markdown processing. This gem provides Ruby bindings for mq.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 13.0
~> 0.9
~> 3.0
 Project Readme

mq-ruby

Gem Version License: MIT

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

Ruby API

Once complete, the Ruby API will look like this:

require 'mq'

# Basic usage
markdown = <<~MD
  # Main Title
  ## Section 1
  Some content here.
  ## Section 2
  More content.
MD

result = MQ.run('.h2', markdown)
result.values.each do |heading|
  puts heading
end
# => ## Section 1
# => ## Section 2

# With options
options = MQ::Options.new
options.input_format = MQ::InputFormat::HTML

result = MQ.run('.h1', '<h1>Hello</h1><p>World</p>', options)
puts result.text  # => # Hello

# HTML to Markdown conversion
html = '<h1>Title</h1><p>Paragraph</p>'
markdown = MQ.html_to_markdown(html)
puts markdown  # => # Title\n\nParagraph

License

The gem is available as open source under the terms of the MIT License.

Links