Name | markdown-query JSON |
Version |
0.2.21
JSON |
| download |
home_page | None |
Summary | Python bindings for mq, a jq-like command-line tool for Markdown processing |
upload_time | 2025-09-03 14:28:33 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | MIT |
keywords |
markdown
jq
command-line
tool
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# mq
[](https://github.com/harehare/mq/actions/workflows/ci.yml)

[](https://codecov.io/gh/harehare/mq)
[](https://codspeed.io/harehare/mq)
Python bindings for the mq Markdown processor.
## Overview
`markdown-query` provides Python bindings to the [`mq`](https://github.com/harehare/mq), allowing Python developers to use mq's Markdown processing capabilities directly from Python code.
## Installation
```bash
pip install markdown-query
```
## Usage
````python
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).values)
# ['# Hello', '```js\nconsole.log("code")\n```']
print(mq.run("select(or(.h1, .code)) | to_text()", markdown, None).values)
# ['Hello', 'console.log("code")']
print(mq.run("select(or(.h1, .code)) | to_text()", markdown, None)[0].text)
# Hello
print([m for m in mq.run("select(or(.h1, .code))", markdown, None)])
# MarkdownType.Heading
print(mq.run("select(or(.h1, .code))", markdown, None)[0].markdown_type)
# MarkdownType.Heading
# 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).values)
# ['# TITLE']
````
### Using with markitdown
You can combine `mq` with [markitdown](https://github.com/microsoft/markitdown) for even more powerful Markdown processing workflows:
```python
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](https://mqlang.org/book/).
## Playground
An [Online Playground](https://mqlang.org/playground) is available, powered by WebAssembly.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "markdown-query",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "markdown, jq, command-line, tool",
"author": null,
"author_email": "harehare <harehare1110@gmail.com>",
"download_url": null,
"platform": null,
"description": "# mq\n\n[](https://github.com/harehare/mq/actions/workflows/ci.yml)\n\n[](https://codecov.io/gh/harehare/mq)\n[](https://codspeed.io/harehare/mq)\n\nPython bindings for the mq Markdown processor.\n\n## Overview\n\n`markdown-query` provides Python bindings to the [`mq`](https://github.com/harehare/mq), allowing Python developers to use mq's Markdown processing capabilities directly from Python code.\n\n## Installation\n\n```bash\npip install markdown-query\n```\n\n## Usage\n\n````python\nimport mq\n\n# Process a markdown string with an mq query\nmarkdown = '# Hello\\n\\nThis is a paragraph\\n\\n## Section\\n\\nMore text.\\n\\n```js\\nconsole.log(\"code\")\\n```'\n\nprint(mq.run(\"select(or(.h1, .code))\", markdown, None).values)\n# ['# Hello', '```js\\nconsole.log(\"code\")\\n```']\n\nprint(mq.run(\"select(or(.h1, .code)) | to_text()\", markdown, None).values)\n# ['Hello', 'console.log(\"code\")']\n\nprint(mq.run(\"select(or(.h1, .code)) | to_text()\", markdown, None)[0].text)\n# Hello\n\nprint([m for m in mq.run(\"select(or(.h1, .code))\", markdown, None)])\n# MarkdownType.Heading\n\nprint(mq.run(\"select(or(.h1, .code))\", markdown, None)[0].markdown_type)\n# MarkdownType.Heading\n\n# Process a html string with an mq query\nmarkdown = '<h1>Title</h1><p>Paragraph</p>'\n\noptions = mq.Options()\noptions.input_format = mq.InputFormat.HTML\nprint(mq.run(\".h1 | upcase()\", markdown, options).values)\n# ['# TITLE']\n````\n\n### Using with markitdown\n\nYou can combine `mq` with [markitdown](https://github.com/microsoft/markitdown) for even more powerful Markdown processing workflows:\n\n```python\nfrom markitdown import MarkItDown\nimport mq\n\nmarkitdown = MarkItDown()\nresult = markitdown.convert(\"https://github.com/harehare/mq\")\n\nprint(mq.run(\".code | to_text()\", result, None))\nprint(mq.run(\".[] | to_html()\", result, None))\n```\n\nFor more detailed usage and examples, refer to the [documentation](https://mqlang.org/book/).\n\n## Playground\n\nAn [Online Playground](https://mqlang.org/playground) is available, powered by WebAssembly.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python bindings for mq, a jq-like command-line tool for Markdown processing",
"version": "0.2.21",
"project_urls": {
"Documentation": "https://mqlang.org/book/",
"Homepage": "https://mqlang.org/",
"Issues": "https://github.com/harehare/mq/issues",
"Repository": "https://github.com/harehare/mq.git"
},
"split_keywords": [
"markdown",
" jq",
" command-line",
" tool"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2ed9568a558c93c8a17d971362b68153d24155624d24f89ad212a13e396ff4da",
"md5": "c802878dc0ebad2dba77d9856fcc0f5c",
"sha256": "01a773f45ab3db5e0fe963dc834bc633453080857334cd8424f005cdeb4dafa7"
},
"downloads": -1,
"filename": "markdown_query-0.2.21-cp313-cp313t-win_amd64.whl",
"has_sig": false,
"md5_digest": "c802878dc0ebad2dba77d9856fcc0f5c",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.10",
"size": 1093554,
"upload_time": "2025-09-03T14:28:33",
"upload_time_iso_8601": "2025-09-03T14:28:33.686949Z",
"url": "https://files.pythonhosted.org/packages/2e/d9/568a558c93c8a17d971362b68153d24155624d24f89ad212a13e396ff4da/markdown_query-0.2.21-cp313-cp313t-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b95033129b347cbda7ed82de1563bef988a7740eedfbd0285e184c34a337e5bc",
"md5": "60f36d328a4985dbd87884ef59de4c00",
"sha256": "14d52f78527b536f415b15a7a2f5be10d1f7904224884dcf4d429cdf809add1a"
},
"downloads": -1,
"filename": "markdown_query-0.2.21-cp39-abi3-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "60f36d328a4985dbd87884ef59de4c00",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.10",
"size": 1094486,
"upload_time": "2025-09-03T14:28:35",
"upload_time_iso_8601": "2025-09-03T14:28:35.186478Z",
"url": "https://files.pythonhosted.org/packages/b9/50/33129b347cbda7ed82de1563bef988a7740eedfbd0285e184c34a337e5bc/markdown_query-0.2.21-cp39-abi3-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "470760144073726ad1d0eb28e26b022514aee7d624efe6dc2df248df5e4c0fed",
"md5": "cfdde142d492c12f69c1df819755242e",
"sha256": "4ec2283f00cb698c3c195b733d04cc379ff749aab1172a2dfe7dd07c7243d974"
},
"downloads": -1,
"filename": "markdown_query-0.2.21-cp39-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "cfdde142d492c12f69c1df819755242e",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.10",
"size": 1010886,
"upload_time": "2025-09-03T14:28:36",
"upload_time_iso_8601": "2025-09-03T14:28:36.818414Z",
"url": "https://files.pythonhosted.org/packages/47/07/60144073726ad1d0eb28e26b022514aee7d624efe6dc2df248df5e4c0fed/markdown_query-0.2.21-cp39-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0edef62ce9b2fb6ab4257a6c73f2180e3e476b160cabaacef481d73d85e13fda",
"md5": "d08c02114f2cde7784df6793b2cc99aa",
"sha256": "958c54c3b233be326287779389ec25f3a8f7fc71903b26ccd661587517d9adf0"
},
"downloads": -1,
"filename": "markdown_query-0.2.21-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "d08c02114f2cde7784df6793b2cc99aa",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.10",
"size": 1047590,
"upload_time": "2025-09-03T14:28:38",
"upload_time_iso_8601": "2025-09-03T14:28:38.528528Z",
"url": "https://files.pythonhosted.org/packages/0e/de/f62ce9b2fb6ab4257a6c73f2180e3e476b160cabaacef481d73d85e13fda/markdown_query-0.2.21-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "68d67e5561b33d4a2bae8d5652093a156b2739ba3aa09ac3dd3ee1f66cdeac04",
"md5": "8abfd33eb3fa519f96b7957728566ea4",
"sha256": "cac8022078b4661436007298dfb1750a549cfeb241300787b525156b10681a18"
},
"downloads": -1,
"filename": "markdown_query-0.2.21-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "8abfd33eb3fa519f96b7957728566ea4",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.10",
"size": 1107831,
"upload_time": "2025-09-03T14:28:39",
"upload_time_iso_8601": "2025-09-03T14:28:39.768334Z",
"url": "https://files.pythonhosted.org/packages/68/d6/7e5561b33d4a2bae8d5652093a156b2739ba3aa09ac3dd3ee1f66cdeac04/markdown_query-0.2.21-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "964933a68ba2af2fc5d2fac25f9e4c22037399456107433a840422db4d5b00e5",
"md5": "be1bb2e6ae14c27ae47ecc16af9b4647",
"sha256": "95e801c00d6acdfbb7a9b8c10a482f42a3432d47351767bb94239b56be173dac"
},
"downloads": -1,
"filename": "markdown_query-0.2.21-cp39-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "be1bb2e6ae14c27ae47ecc16af9b4647",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.10",
"size": 1096795,
"upload_time": "2025-09-03T14:28:40",
"upload_time_iso_8601": "2025-09-03T14:28:40.912181Z",
"url": "https://files.pythonhosted.org/packages/96/49/33a68ba2af2fc5d2fac25f9e4c22037399456107433a840422db4d5b00e5/markdown_query-0.2.21-cp39-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "3b0b1ddf5990b26d8125e9c21a3123c2dd7b0a449bc9fbf93c36fd33159f153d",
"md5": "7105b7e3f455317c05a2fc1bd034fddf",
"sha256": "06bafcbccec678667c3b0dde1cd178017da3902e683d37f85fa5b328cce44cb0"
},
"downloads": -1,
"filename": "markdown_query-0.2.21-pp310-pypy310_pp73-win_amd64.whl",
"has_sig": false,
"md5_digest": "7105b7e3f455317c05a2fc1bd034fddf",
"packagetype": "bdist_wheel",
"python_version": "pp310",
"requires_python": ">=3.10",
"size": 1098877,
"upload_time": "2025-09-03T14:28:42",
"upload_time_iso_8601": "2025-09-03T14:28:42.623598Z",
"url": "https://files.pythonhosted.org/packages/3b/0b/1ddf5990b26d8125e9c21a3123c2dd7b0a449bc9fbf93c36fd33159f153d/markdown_query-0.2.21-pp310-pypy310_pp73-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d1f99e43e91148b17f9ece2b189b046b151e2d91b427ead5802c69a520325502",
"md5": "4af806e18dcbb3e2dace72ba3f3a8205",
"sha256": "9ba826efcf591b7645dd4982f0071816081331efc4a5ff4d18ed51fa7d9cd306"
},
"downloads": -1,
"filename": "markdown_query-0.2.21-pp311-pypy311_pp73-win_amd64.whl",
"has_sig": false,
"md5_digest": "4af806e18dcbb3e2dace72ba3f3a8205",
"packagetype": "bdist_wheel",
"python_version": "pp311",
"requires_python": ">=3.10",
"size": 1095097,
"upload_time": "2025-09-03T14:28:44",
"upload_time_iso_8601": "2025-09-03T14:28:44.031009Z",
"url": "https://files.pythonhosted.org/packages/d1/f9/9e43e91148b17f9ece2b189b046b151e2d91b427ead5802c69a520325502/markdown_query-0.2.21-pp311-pypy311_pp73-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1f965fd71a6fd78401cd3ce262ee32e4551af29e1c3b6dcab867ec6ea08098f5",
"md5": "f710e9db8ae754bc352ea5d77d89104c",
"sha256": "94bc43e167a6bf983a00768c790e65b28d33cfbdd4f2c64a58c538c289208de2"
},
"downloads": -1,
"filename": "markdown_query-0.2.21-pp39-pypy39_pp73-win_amd64.whl",
"has_sig": false,
"md5_digest": "f710e9db8ae754bc352ea5d77d89104c",
"packagetype": "bdist_wheel",
"python_version": "pp39",
"requires_python": ">=3.10",
"size": 1096601,
"upload_time": "2025-09-03T14:28:46",
"upload_time_iso_8601": "2025-09-03T14:28:46.111600Z",
"url": "https://files.pythonhosted.org/packages/1f/96/5fd71a6fd78401cd3ce262ee32e4551af29e1c3b6dcab867ec6ea08098f5/markdown_query-0.2.21-pp39-pypy39_pp73-win_amd64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-03 14:28:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "harehare",
"github_project": "mq",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "markdown-query"
}