{"id":45187800,"url":"https://github.com/cnkang/markdown2docx","last_synced_at":"2026-02-20T11:04:49.938Z","repository":{"id":308837298,"uuid":"1034266556","full_name":"cnkang/markdown2docx","owner":"cnkang","description":"Modern Python tool for converting Markdown to DOCX with template support, syntax highlighting, and Office 2019+ compatibility","archived":false,"fork":false,"pushed_at":"2026-02-10T00:11:06.000Z","size":325,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-10T05:33:11.337Z","etag":null,"topics":["academic-writing","cli","converter","document-generation","markdown","office","pandoc","python","syntax-highlighting","template","word-document"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cnkang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-08T05:50:59.000Z","updated_at":"2026-02-10T00:10:41.000Z","dependencies_parsed_at":"2025-08-08T11:39:56.285Z","dependency_job_id":null,"html_url":"https://github.com/cnkang/markdown2docx","commit_stats":null,"previous_names":["cnkang/markdown2pdf","cnkang/markdown2docx"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cnkang/markdown2docx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnkang%2Fmarkdown2docx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnkang%2Fmarkdown2docx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnkang%2Fmarkdown2docx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnkang%2Fmarkdown2docx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cnkang","download_url":"https://codeload.github.com/cnkang/markdown2docx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnkang%2Fmarkdown2docx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29648489,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T09:27:29.698Z","status":"ssl_error","status_checked_at":"2026-02-20T09:26:12.373Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["academic-writing","cli","converter","document-generation","markdown","office","pandoc","python","syntax-highlighting","template","word-document"],"created_at":"2026-02-20T11:04:49.319Z","updated_at":"2026-02-20T11:04:49.931Z","avatar_url":"https://github.com/cnkang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Markdown to DOCX Converter\n\n[中文文档](README_zh.md) | English\n\nA Python tool for converting Markdown files to modern DOCX format Word documents with support for the latest document standards and formatting.\n\n## Key Features\n\n- ✅ **Modern Markdown Syntax** - Support for strikethrough, superscript/subscript, task lists, and more\n- ✅ **Latest DOCX Standards** - Compatible with Office 2019+ and latest versions\n- ✅ **Template System** - Use custom DOCX templates for consistent styling\n- ✅ **Advanced Tables** - Support for complex table layouts and alignment\n- ✅ **Code Highlighting** - Multi-language syntax highlighting support\n- ✅ **Footnotes \u0026 References** - Academic document features\n- ✅ **Table of Contents** - Automatic TOC generation\n- ✅ **Command Line Interface** - Easy-to-use CLI tool\n- ✅ **Programmatic API** - Flexible programming interface\n\n## Installation\n\nRun the setup script to install dependencies and ensure Pandoc is available:\n\n```bash\n./scripts/setup-env.sh\n```\n\n**Note:** The setup script is designed for Unix-like systems (Linux, macOS). Windows users should install dependencies manually.\n\nTo include development dependencies (e.g., for running tests), pass additional `uv sync` options:\n\n```bash\n./scripts/setup-env.sh --group dev\n```\n\nOr install dependencies manually using uv:\n\n```bash\nuv sync\n```\n\nEnsure Pandoc 2.19+ is installed for optimal compatibility:\n\n```bash\n# macOS\nbrew install pandoc\n\n# Ubuntu/Debian\nsudo apt-get install pandoc\n\n# Or download from: https://pandoc.org/installing.html\n```\n\n## Usage\n\n### Command Line Usage\n\n```bash\n# Basic conversion\nuv run python -m src.markdown2docx.cli input.md\n\n# Specify output file\nuv run python -m src.markdown2docx.cli input.md -o output.docx\n\n# Use custom template\nuv run python -m src.markdown2docx.cli input.md --template custom.docx\n\n# Include table of contents\nuv run python -m src.markdown2docx.cli input.md --toc --toc-depth 3\n\n# Create modern DOCX template\nuv run python -m src.markdown2docx.cli --create-template modern_template.docx\n```\n\n### Programmatic Usage\n\n```python\nfrom src.markdown2docx import MarkdownToDocxConverter\nfrom src.markdown2docx.templates import DocxTemplateManager\n\n# Basic conversion\nconverter = MarkdownToDocxConverter()\noutput_path = converter.convert(\"input.md\", \"output.docx\")\n\n# Template-based conversion\nconverter = MarkdownToDocxConverter(reference_doc=\"template.docx\")\noutput_path = converter.convert(\"input.md\", \"output.docx\")\n\n# Conversion with options\noutput_path = converter.convert(\n    \"input.md\",\n    \"output.docx\",\n    toc=True,\n    toc_depth=3,\n)\n\n# Create modern template\ntemplate_path = DocxTemplateManager.create_modern_template(\"modern.docx\")\n\n# Template-based conversion\noutput_path = converter.convert_with_template(\n    \"input.md\", \n    \"modern.docx\", \n    \"output.docx\"\n)\n```\n\n## Supported Markdown Features\n\n### Text Formatting\n- **Bold**, *italic*, ~~strikethrough~~\n- `Inline code`\n- Superscript^2^, subscript~2~\n- Block quotes\n\n### Lists\n- Unordered and ordered lists\n- Nested lists\n- Task lists `- [x] Completed task`\n\n### Code Blocks\n- Syntax highlighting\n- Multiple programming language support\n\n### Tables\n- Basic tables\n- Column alignment (left, center, right)\n- Complex table layouts\n\n### Advanced Features\n- Footnotes and references\n- Internal links\n- Mathematical formulas (with proper Pandoc configuration)\n- Definition lists\n\n## Modern DOCX Standards Support\n\nThis tool ensures generated DOCX files comply with the latest standards:\n\n- **Office 2019+ Compatibility** - Uses modern XML structure\n- **Responsive Layout** - Adapts to different screen sizes\n- **Modern Fonts** - Defaults to Calibri and other modern fonts\n- **Standard Margins** - 1-inch standard margins\n- **Consistent Styling** - Unified heading and paragraph styles\n- **Table Styling** - Modern table formatting\n\n## Development\n\nRun tests:\n\n```bash\nuv run pytest\n```\n\nRun tests with coverage:\n\n```bash\nuv run pytest --cov=src\n```\n\nTest example conversion:\n\n```bash\nuv run python -m src.markdown2docx.cli example.md -o example_output.docx\n```\n\n## System Requirements\n\n- Python 3.13+\n- Pandoc 2.19+ (recommended)\n- pypandoc \u003e= 1.13\n- python-docx \u003e= 1.1.2\n- lxml \u003e= 5.0.0\n\n## Troubleshooting\n\n### Pandoc Version Issues\nIf you encounter conversion problems, check your Pandoc version:\n\n```bash\npandoc --version\n```\n\nWe recommend version 2.19+ for optimal modern DOCX support.\n\n### Template Issues\nIf custom templates don't work, try using the built-in modern template:\n\n```bash\nuv run python -m src.markdown2docx.cli --create-template modern.docx\nuv run python -m src.markdown2docx.cli input.md --template modern.docx\n```\n\n## License\n\nMIT License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnkang%2Fmarkdown2docx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcnkang%2Fmarkdown2docx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnkang%2Fmarkdown2docx/lists"}