Skip to main content

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

Project description

mq

ci GitHub Release codecov CodSpeed Badge

Python bindings for the mq Markdown processor.

Overview

markdown-query provides Python bindings to the mq, allowing Python developers to use mq's Markdown processing capabilities directly from Python code.

Installation

pip install markdown-query

Usage

import mq

# Process a markdown string with an mq query
markdown = '# Hello\n\nThis is a paragraph\n\n## Section\n\nMore text.\n\n```js\nconsole.log("code")\n```'

print(mq.run("select(or(.h1, .code))", markdown, None))
# ['# Hello', '```js\nconsole.log("code")\n```']

print(mq.run("select(or(.h1, .code)) | to_text()", markdown, None))
# ['Hello', 'console.log("code")']

# Process a html string with an mq query
markdown = '<h1>Title</h1><p>Paragraph</p>'

options = mq.Options()
options.input_format = mq.InputFormat.HTML
print(mq.run(".h1 | upcase()", markdown, options))
# ['TITLE']

Using with markitdown

You can combine mq with markitdown for even more powerful Markdown processing workflows:

from markitdown import MarkItDown
import mq

markitdown = MarkItDown()
result = markitdown.convert("https://github.com/harehare/mq")

print(mq.run(".code | to_text()", result, None))
print(mq.run(".[] | to_html()", result, None))

For more detailed usage and examples, refer to the documentation.

Playground

An Online Playground is available, powered by WebAssembly.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

markdown_query-0.1.2-pp311-pypy311_pp73-win_amd64.whl (1.4 MB view details)

Uploaded PyPyWindows x86-64

markdown_query-0.1.2-pp310-pypy310_pp73-win_amd64.whl (1.4 MB view details)

Uploaded PyPyWindows x86-64

markdown_query-0.1.2-pp39-pypy39_pp73-win_amd64.whl (1.4 MB view details)

Uploaded PyPyWindows x86-64

markdown_query-0.1.2-cp313-cp313t-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.13tWindows x86-64

markdown_query-0.1.2-cp39-abi3-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9+Windows x86-64

markdown_query-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

markdown_query-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

markdown_query-0.1.2-cp39-abi3-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

markdown_query-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file markdown_query-0.1.2-pp311-pypy311_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for markdown_query-0.1.2-pp311-pypy311_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 ee39794a1149281d2bb271a1ddab6bd4ac22574e20a7358f8f1393f466d13961
MD5 073225a318d8a3bb9a732444a2eaefde
BLAKE2b-256 049d6af451c1563b57b9107883e52c78af90fe2ef46dfac783a79990504c6569

See more details on using hashes here.

File details

Details for the file markdown_query-0.1.2-pp310-pypy310_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for markdown_query-0.1.2-pp310-pypy310_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 7e689ef38c42148493455ec8f6ab65de231d83503e9f1f86e910a688c3b13735
MD5 45afcac17f8152468e1e0cf04b9f535d
BLAKE2b-256 6c5ee921abeebc550a4c955cd21ed805867f4cd945421630f72bb25ff42bffab

See more details on using hashes here.

File details

Details for the file markdown_query-0.1.2-pp39-pypy39_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for markdown_query-0.1.2-pp39-pypy39_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 89aee19b489edb0ac5677631492e349b045ea7b2e14209a8a048e2c6ecd21ba2
MD5 663c70d73c4213ba5d747eda095efc2f
BLAKE2b-256 3364ae9230aac59dbf4d0b9da39378dd56a466c7ec1a1d5a738b6b0abc2aa99f

See more details on using hashes here.

File details

Details for the file markdown_query-0.1.2-cp313-cp313t-win_amd64.whl.

File metadata

File hashes

Hashes for markdown_query-0.1.2-cp313-cp313t-win_amd64.whl
Algorithm Hash digest
SHA256 2ff38b908d6830194a6d40d3373adab9cc20a98a2c96ff41183115431a4ee140
MD5 07dfdb5befcdc410ebafe5959e84a24c
BLAKE2b-256 7bf8f664ea8f3967f4ea938a5ecda64b8f1bac34a794b4bbe2ba9f09626a755c

See more details on using hashes here.

File details

Details for the file markdown_query-0.1.2-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for markdown_query-0.1.2-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ffebad221d49bd0579bfb094904b04d3011a1f05619a19573e67ef60312fa66c
MD5 0de37d80e0ce40e960009f25bf92652b
BLAKE2b-256 65e6a042de8cc5900336cb0eb5b26dae052d220ce25324c9fa0f38d5cb2020e0

See more details on using hashes here.

File details

Details for the file markdown_query-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for markdown_query-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f3c4773972dcbeb01704c6829ee1afef85bf0406b11b13c9c1285c459f349252
MD5 e4a10a3ad8ff534ca08c72382944563b
BLAKE2b-256 9072168c6d4c4a2659294ce522a177009bc49639b39b4f667805d0b15926f4e8

See more details on using hashes here.

File details

Details for the file markdown_query-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for markdown_query-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b2dd4e4d0631adaac8d85ab30cc862f7fb145b986a7265e5b64531d01728b42f
MD5 6153da22c10cf21c60bc50901f696fc5
BLAKE2b-256 3b86db3e62e5d8c728c673d0b638eee194afc35b11cf5a4dc29f23c4536d4a92

See more details on using hashes here.

File details

Details for the file markdown_query-0.1.2-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for markdown_query-0.1.2-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9419b521a2ea091b5d0375f3f4b050bd55dad875255c50c76929cfc467a820da
MD5 91d7fd532e2b4ea75a17b09ab8d6fa47
BLAKE2b-256 3d0ab9d01063689e9b79967110e97c34dfecb9a24d1994c9e984bc8045e806ea

See more details on using hashes here.

File details

Details for the file markdown_query-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for markdown_query-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 01ea065f46d213e37b75aa5473022f1fb7492ce071bcfc13bc51e1019e47f987
MD5 837fcb54ac306a57bfa059fb3592f275
BLAKE2b-256 efdb8704d166d86a55d34da2cf7d2169928e02368fadd7ee9c3317c053cdf9ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page