{"id":21637815,"url":"https://github.com/educationwarehouse/mdast","last_synced_at":"2026-05-09T19:33:05.695Z","repository":{"id":261399044,"uuid":"883220059","full_name":"educationwarehouse/mdast","owner":"educationwarehouse","description":"Python bindings for the `mdast` markdown ast json format","archived":false,"fork":false,"pushed_at":"2024-11-06T10:18:21.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T01:41:28.394Z","etag":null,"topics":["ast","markdown","mdast","rust-bindings"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/mdast","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/educationwarehouse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-04T15:27:35.000Z","updated_at":"2024-12-30T22:30:52.000Z","dependencies_parsed_at":"2024-11-06T11:38:05.292Z","dependency_job_id":null,"html_url":"https://github.com/educationwarehouse/mdast","commit_stats":null,"previous_names":["educationwarehouse/mdast"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/educationwarehouse%2Fmdast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/educationwarehouse%2Fmdast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/educationwarehouse%2Fmdast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/educationwarehouse%2Fmdast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/educationwarehouse","download_url":"https://codeload.github.com/educationwarehouse/mdast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244327592,"owners_count":20435454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","markdown","mdast","rust-bindings"],"created_at":"2024-11-25T04:07:01.875Z","updated_at":"2026-05-09T19:33:05.688Z","avatar_url":"https://github.com/educationwarehouse.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mdast.py\n\nSimple Python bindings for the [mdast](https://github.com/syntax-tree/mdast) functionality of [wooorm/markdown-rs](https://github.com/wooorm/markdown-rs/)\n\n## Installation\n\n```bash\npip install mdast\n```\n\nIf you're on x86-64/AMD64 or arm64/aarch64, you can install this package without having Rust on your system.\nFor other platforms, the Rust toolchain is required to build the binary dependencies.\n\n## Usage\n\n### Converting from Markdown to mdast's AST format\n\n```python\nimport mdast\n\nmdast.md_to_ast(\"# title\")\n# -\u003e {'type': 'root', 'children': [{'type': 'heading', 'children': [{'type': 'text', 'value': 'title'}], 'depth': 1}]}\n```\n\n### Converting from Markdown to mdast's JSON format\n\n```python\nimport mdast\n\nmdast.md_to_json(\"# title\")\n# -\u003e '{\"type\": \"root\", \"children\": [{\"type\": \"heading\", \"children\": [{\"type\": \"text\", \"value\": \"title\"}], \"depth\": 1}]}'\n```\n\n### Converting from mdast AST to Markdown\n\n```python\nimport mdast\n\nast = {'type': 'root', 'children': [{'type': 'heading', 'children': [{'type': 'text', 'value': 'title'}], 'depth': 1}]}\nmdast.ast_to_md(ast)\n# -\u003e '# title\\n'\n```\n\n### Converting from mdast JSON to Markdown\n\n```python\nimport mdast\n\njson_str = '{\"type\": \"root\", \"children\": [{\"type\": \"heading\", \"children\": [{\"type\": \"text\", \"value\": \"title\"}], \"depth\": 1}]}'\nmdast.json_to_md(json_str)\n# -\u003e '# title\\n'\n```\n\n### Converting from Markdown to HTML\n\n```python\nimport mdast\n\nmdast.md_to_html(\"# title\")\n# -\u003e '\u003ch1\u003etitle\u003c/h1\u003e'\n```\n\n### Converting from mdast AST to HTML\n\n```python\nimport mdast\n\nast = {'type': 'root', 'children': [{'type': 'heading', 'children': [{'type': 'text', 'value': 'title'}], 'depth': 1}]}\nmdast.ast_to_html(ast)\n# -\u003e '\u003ch1\u003etitle\u003c/h1\u003e'\n```\n\n### Converting from mdast JSON to HTML\n\n```python\nimport mdast\n\njson_str = '{\"type\": \"root\", \"children\": [{\"type\": \"heading\", \"children\": [{\"type\": \"text\", \"value\": \"title\"}], \"depth\": 1}]}'\nmdast.json_to_html(json_str)\n# -\u003e '\u003ch1\u003etitle\u003c/h1\u003e'\n```\n\n## Configuration Options\n\n### Parsing Options\n\nThe `ParseOptions` class allows customization of Markdown parsing behavior:\n\n```python\nfrom mdast import ParseOptions\n\ndefault_options = ParseOptions(\n    # you can specify overwrites here\n    frontmatter=True,\n)\ngfm_options = ParseOptions.gfm()\nmdx_options = ParseOptions.mdx()\n```\n\n### Markdown Generation Options\n\nThe `MarkdownOptions` class customizes how Markdown is generated:\n\n```python\nfrom mdast import MarkdownOptions\n\noptions = MarkdownOptions(fences=False, emphasis=\"_\")\n```\n\nNote that the Markdown generation of wooorm/markdown-rs does not support MDX or GFM generation.\n\n\n### HTML Generation Options\n\nThe `GenerationOptions` class customizes how HTML is generated:\n\n```python\nfrom mdast import GenerationOptions\n\noptions = GenerationOptions(allow_dangerous_html=True)\n```\n\n## License\n\nThis project is licensed under the MIT License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feducationwarehouse%2Fmdast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feducationwarehouse%2Fmdast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feducationwarehouse%2Fmdast/lists"}