Name | markdown-query JSON |
Version |
0.2.9
JSON |
| download |
home_page | None |
Summary | Python bindings for mq, a jq-like command-line tool for Markdown processing |
upload_time | 2025-07-12 14:57:48 |
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.9",
"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": "02b54657d4df52d9a3bd92d4ca43118d3dd86918267e502444724ff21d840c5f",
"md5": "ccb32eee4d02e699787c12a6753a522e",
"sha256": "26c81db0e10f9fa49b795790703d974c2759e7e9342e95ef13e532649299506c"
},
"downloads": -1,
"filename": "markdown_query-0.2.9-cp313-cp313t-win_amd64.whl",
"has_sig": false,
"md5_digest": "ccb32eee4d02e699787c12a6753a522e",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.10",
"size": 1499821,
"upload_time": "2025-07-12T14:57:48",
"upload_time_iso_8601": "2025-07-12T14:57:48.360048Z",
"url": "https://files.pythonhosted.org/packages/02/b5/4657d4df52d9a3bd92d4ca43118d3dd86918267e502444724ff21d840c5f/markdown_query-0.2.9-cp313-cp313t-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f0a8e327b8ba895a34b61c630104ec5a4dcc31e6ddf4c19a015d2c023e07995e",
"md5": "310cc12e5d670d2bcf15c4f6b4732c0d",
"sha256": "70a36d07bea96bfe5ad8f76e7c89eada5541aef4d601d6e870d1514b28acfae9"
},
"downloads": -1,
"filename": "markdown_query-0.2.9-cp39-abi3-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "310cc12e5d670d2bcf15c4f6b4732c0d",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.10",
"size": 1493772,
"upload_time": "2025-07-12T14:57:50",
"upload_time_iso_8601": "2025-07-12T14:57:50.284600Z",
"url": "https://files.pythonhosted.org/packages/f0/a8/e327b8ba895a34b61c630104ec5a4dcc31e6ddf4c19a015d2c023e07995e/markdown_query-0.2.9-cp39-abi3-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "31eb9dfebd11867bc308f0d744a288c34097d0867c99414bc6cae67f1ed22ed2",
"md5": "d78249d0fa9a8b15cbed464e785dba18",
"sha256": "0ddbffa2528cc66c61e047e5aa4d00709f59f0967f92b78e76951564dfed7197"
},
"downloads": -1,
"filename": "markdown_query-0.2.9-cp39-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "d78249d0fa9a8b15cbed464e785dba18",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.10",
"size": 1363513,
"upload_time": "2025-07-12T14:57:51",
"upload_time_iso_8601": "2025-07-12T14:57:51.768361Z",
"url": "https://files.pythonhosted.org/packages/31/eb/9dfebd11867bc308f0d744a288c34097d0867c99414bc6cae67f1ed22ed2/markdown_query-0.2.9-cp39-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c6a0c83a2f01fc78ccdea5148ed21e0c027f1089b289c9a788b9b08fa899ca97",
"md5": "7412af39015e46f4b211e30024c9693c",
"sha256": "a2840aa0e5d81bd597d922862efbca1e237f3c8de9ee139f1805c824d5850cce"
},
"downloads": -1,
"filename": "markdown_query-0.2.9-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "7412af39015e46f4b211e30024c9693c",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.10",
"size": 1419683,
"upload_time": "2025-07-12T14:57:53",
"upload_time_iso_8601": "2025-07-12T14:57:53.331267Z",
"url": "https://files.pythonhosted.org/packages/c6/a0/c83a2f01fc78ccdea5148ed21e0c027f1089b289c9a788b9b08fa899ca97/markdown_query-0.2.9-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "81f5426425595a27520005d1e6fa4d7c10bd2ea872c10bbbef5ddaf601d04ca5",
"md5": "cc654e699a57dad48a9eb88493340a1d",
"sha256": "c5229c6f1b1fc9483b2c899e02815f60c48ce8d4daedf21eb860ae3eab8ac148"
},
"downloads": -1,
"filename": "markdown_query-0.2.9-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "cc654e699a57dad48a9eb88493340a1d",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.10",
"size": 1531378,
"upload_time": "2025-07-12T14:57:54",
"upload_time_iso_8601": "2025-07-12T14:57:54.903360Z",
"url": "https://files.pythonhosted.org/packages/81/f5/426425595a27520005d1e6fa4d7c10bd2ea872c10bbbef5ddaf601d04ca5/markdown_query-0.2.9-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "46309cbdebd115da658e94f37e35e84c6b85a9f4e67224998cdd2e286b2b2587",
"md5": "8baa1b2c511e3e5abd718d5eb0917023",
"sha256": "64bfdf79c41b0c37d35c875b24d0ce35dbc9585759006b33d0bdf7b0d33a3e96"
},
"downloads": -1,
"filename": "markdown_query-0.2.9-cp39-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "8baa1b2c511e3e5abd718d5eb0917023",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.10",
"size": 1503803,
"upload_time": "2025-07-12T14:57:56",
"upload_time_iso_8601": "2025-07-12T14:57:56.435542Z",
"url": "https://files.pythonhosted.org/packages/46/30/9cbdebd115da658e94f37e35e84c6b85a9f4e67224998cdd2e286b2b2587/markdown_query-0.2.9-cp39-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7f9f825a3b528905e49ef5ab48628287d753288227033bc7ab378a26ac6bc07a",
"md5": "6fc15016de8891fbcfcff466f05c502f",
"sha256": "bc2ccbc324a75eee171807ef8b8325480c5b2b41a3bef0369217b5de2b53622e"
},
"downloads": -1,
"filename": "markdown_query-0.2.9-pp310-pypy310_pp73-win_amd64.whl",
"has_sig": false,
"md5_digest": "6fc15016de8891fbcfcff466f05c502f",
"packagetype": "bdist_wheel",
"python_version": "pp310",
"requires_python": ">=3.10",
"size": 1504226,
"upload_time": "2025-07-12T14:57:57",
"upload_time_iso_8601": "2025-07-12T14:57:57.969779Z",
"url": "https://files.pythonhosted.org/packages/7f/9f/825a3b528905e49ef5ab48628287d753288227033bc7ab378a26ac6bc07a/markdown_query-0.2.9-pp310-pypy310_pp73-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "93940b41bc89fb715b1b691d3644bdee186e08586eabd0fe2d3fc3c006fd7494",
"md5": "cf7f02fd0f6cfa713e2f0d74ee088211",
"sha256": "007bc5225839002fa9d983db4dd590352de8c3354ad5412d51092e36c42e4a18"
},
"downloads": -1,
"filename": "markdown_query-0.2.9-pp311-pypy311_pp73-win_amd64.whl",
"has_sig": false,
"md5_digest": "cf7f02fd0f6cfa713e2f0d74ee088211",
"packagetype": "bdist_wheel",
"python_version": "pp311",
"requires_python": ">=3.10",
"size": 1501806,
"upload_time": "2025-07-12T14:57:59",
"upload_time_iso_8601": "2025-07-12T14:57:59.566201Z",
"url": "https://files.pythonhosted.org/packages/93/94/0b41bc89fb715b1b691d3644bdee186e08586eabd0fe2d3fc3c006fd7494/markdown_query-0.2.9-pp311-pypy311_pp73-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b2c4c53410e8e9cb1081fbf0e994528c901d51fe6f69f7cc8d099da84d635b70",
"md5": "1b635db8d4b2119003a8c15d84de27ed",
"sha256": "38f9caad4c1190c4f9843b4fdc20234aed2e809067bd38f3854a0aaa77839ceb"
},
"downloads": -1,
"filename": "markdown_query-0.2.9-pp39-pypy39_pp73-win_amd64.whl",
"has_sig": false,
"md5_digest": "1b635db8d4b2119003a8c15d84de27ed",
"packagetype": "bdist_wheel",
"python_version": "pp39",
"requires_python": ">=3.10",
"size": 1503832,
"upload_time": "2025-07-12T14:58:01",
"upload_time_iso_8601": "2025-07-12T14:58:01.012577Z",
"url": "https://files.pythonhosted.org/packages/b2/c4/c53410e8e9cb1081fbf0e994528c901d51fe6f69f7cc8d099da84d635b70/markdown_query-0.2.9-pp39-pypy39_pp73-win_amd64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-12 14:57:48",
"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"
}