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.1-pp311-pypy311_pp73-win_amd64.whl (1.4 MB view details)

Uploaded PyPyWindows x86-64

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

Uploaded PyPyWindows x86-64

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

Uploaded PyPyWindows x86-64

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

Uploaded CPython 3.13tWindows x86-64

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

Uploaded CPython 3.9+Windows x86-64

markdown_query-0.1.1-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.1-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.1-cp39-abi3-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

markdown_query-0.1.1-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.1-pp311-pypy311_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for markdown_query-0.1.1-pp311-pypy311_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 b71ae0f218b2965248e8aaeacc8e2c62f5958748c415f054bdfd91c6b5d5e824
MD5 78fc49766a64e297aeacfd5dc7669f6e
BLAKE2b-256 db0bcdbd09ce97e9d846f49057b97b4923bbeeff05af5c0e5f13f9b116ac6468

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for markdown_query-0.1.1-pp310-pypy310_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 f3faddf53fc012c894ac7850b80854fa99c9246c2fe68294a9b0f97d385d49a9
MD5 96c164be5e054493acf00360ada85c71
BLAKE2b-256 e7128f09b7a7db62f30f2b5b6204f16046154a424d8cd7dbdcc6228d3c94b0ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for markdown_query-0.1.1-pp39-pypy39_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 1218ea9344e53f0c09d25ed19b2354de462dc0cbb5140c8b22d88eb535818ba7
MD5 a83c93d63a8b8aa1863acf7a2f74cb45
BLAKE2b-256 ec82960d0cfbdb88ec6086c396b48aceef609c320aff386670c85801cbfae8b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for markdown_query-0.1.1-cp313-cp313t-win_amd64.whl
Algorithm Hash digest
SHA256 6d6e833f7f55b404d3a23b28d675d5b9cbb06bbb0af3ad440d5a847b6d25fcc0
MD5 f3082ebb646e0b32af00258303dd6d78
BLAKE2b-256 7e8f9fe1d61a0775515e5ec1efe6162012114b8f378e8690a6e7a472809ee61b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for markdown_query-0.1.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 44bb816c591b734e6b22bd0feeb02ee16ebdc0695659e76d90846426e51b2825
MD5 ee42e86f7a2a53a464af601e1ac22ff9
BLAKE2b-256 bf1a938e3f17e302bf55568b3bd02a693282fbcf36b574281cda0c9d409ff16e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for markdown_query-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 de347f5b598a462dfad188dd7c1c6e05c13fd9cc4dc87ec6233de97137e8e578
MD5 f1a086a2ddb79d17c4a144888cf1288f
BLAKE2b-256 24abfe3b73d4f70766ff78f31eb2822fbcadd41879973cc59390af497e7c5268

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for markdown_query-0.1.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dc23d1c53fc2129b8fd1ebcd6311ce3d73e3bbc03f65517dd3546eb5af828adc
MD5 2ad18aacc11176129e2a4ef51d2ec8bc
BLAKE2b-256 9d48f0ccc7da7d92626b82e8eca43c4a4ce68e66356c1acddf4456aa798d78ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for markdown_query-0.1.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 83043d2a8a919a601fc28316c6bad9163622ba5fdb4953b72a4c45174a3c872d
MD5 45cff383d5a5895a2c370a8b91c0870b
BLAKE2b-256 459149d22497e0f3c9b50a9950c2773c24c283b8ff54dcf22f140bf145eae485

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for markdown_query-0.1.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 85b3166e631facb2ec09fefcc551dbb4aa58b3a3d739276d64d5bd54108e9587
MD5 d27212f958401911128345ba5b03ca53
BLAKE2b-256 f9bda570787b142f52ff7b1ae0b7513da376eee612aab21e35ae6df174be0b32

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