{"id":43892680,"url":"https://github.com/andersonby/md2word","last_synced_at":"2026-02-06T17:03:25.796Z","repository":{"id":336284383,"uuid":"1146733146","full_name":"AndersonBY/md2word","owner":"AndersonBY","description":"Convert Markdown files to Word documents (.docx) with extensive customization options","archived":false,"fork":false,"pushed_at":"2026-02-03T17:09:14.000Z","size":76,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-04T06:51:27.475Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/AndersonBY.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":"2026-01-31T15:38:01.000Z","updated_at":"2026-02-03T17:12:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/AndersonBY/md2word","commit_stats":null,"previous_names":["andersonby/md2word"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/AndersonBY/md2word","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersonBY%2Fmd2word","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersonBY%2Fmd2word/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersonBY%2Fmd2word/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersonBY%2Fmd2word/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndersonBY","download_url":"https://codeload.github.com/AndersonBY/md2word/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersonBY%2Fmd2word/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29169384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T16:33:35.550Z","status":"ssl_error","status_checked_at":"2026-02-06T16:33:30.716Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":[],"created_at":"2026-02-06T17:03:22.023Z","updated_at":"2026-02-06T17:03:25.786Z","avatar_url":"https://github.com/AndersonBY.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# md2word\n\n[中文文档](README_zh.md) | English\n\nConvert Markdown files to Word documents (.docx) with extensive customization options.\n\n## Features\n\n- Convert Markdown to Word documents\n- Support for tables, code blocks, images, and more\n- Automatic download and embedding of web images\n- Automatic conversion of unsupported image formats (e.g., WebP)\n- LaTeX formula support (converted to native Word equations)\n- Configurable styles for headings, body text, and other elements\n- Chinese font size support (e.g., \"四号\", \"小四\")\n- Automatic heading numbering with multiple formats\n- Optional table of contents generation\n\n## Installation\n\n### Using uv (recommended)\n\n```bash\n# Install globally\nuv tool install md2word\n\n# Or run directly without installation\nuvx md2word input.md\n```\n\n### Using pip\n\n```bash\npip install md2word\n```\n\n### Downloadable desktop app (no Python required)\n\nIf you prefer a GUI and do not want to install Python, you can download prebuilt executables from the GitHub Releases page.\nLook for the desktop app artifacts for Windows, macOS, and Linux, then unzip and run.\n\n## Usage\n\n### Command Line\n\n```bash\n# Basic conversion (outputs input.docx)\nmd2word input.md\n\n# Specify output file\nmd2word input.md -o output.docx\n\n# Use custom config file\nmd2word input.md -c my_config.json\n\n# Add table of contents\nmd2word input.md --toc\n\n# Custom TOC title and level\nmd2word input.md --toc --toc-title \"Contents\" --toc-level 4\n\n# Generate default config file\nmd2word --init-config\n```\n\n### As a Python Library\n\n```python\nimport md2word\n\n# Simple conversion\nmd2word.convert_file(\"input.md\", \"output.docx\")\n\n# With custom configuration\nconfig = md2word.Config.from_file(\"config.json\")\nmd2word.convert_file(\"input.md\", \"output.docx\", config=config, toc=True)\n\n# Convert from string\nmarkdown_content = \"# Hello World\\n\\nThis is a test.\"\nmd2word.convert(markdown_content, \"output.docx\")\n\n# Programmatic configuration\nconfig = md2word.Config()\nconfig.default_font = \"Arial\"\nconfig.styles[\"heading_1\"] = md2word.StyleConfig(\n    font_name=\"Arial\",\n    font_size=24,\n    bold=True,\n    alignment=\"center\",\n    numbering_format=\"chapter\",\n)\nmd2word.convert_file(\"input.md\", \"output.docx\", config=config)\n```\n\n## Configuration\n\nCreate a `config.json` file to customize document styles.\n\n### Example Configuration\n\n```json\n{\n    \"document\": {\n        \"default_font\": \"Arial\",\n        \"max_image_width_inches\": 6.0\n    },\n    \"styles\": {\n        \"heading_1\": {\n            \"font_name\": \"Arial\",\n            \"font_size\": 24,\n            \"bold\": true,\n            \"alignment\": \"center\",\n            \"line_spacing_rule\": \"exact\",\n            \"line_spacing_value\": 28,\n            \"numbering_format\": \"chapter\"\n        },\n        \"body\": {\n            \"font_name\": \"Times New Roman\",\n            \"font_size\": 12,\n            \"alignment\": \"justify\",\n            \"line_spacing_rule\": \"multiple\",\n            \"line_spacing_value\": 1.5,\n            \"first_line_indent\": 2\n        }\n    }\n}\n```\n\n### Style Properties\n\n| Property | Type | Description |\n|----------|------|-------------|\n| `font_name` | string | Font name |\n| `font_size` | number/string | Font size (points or Chinese size name) |\n| `bold` | boolean | Bold text |\n| `italic` | boolean | Italic text |\n| `color` | string | Font color (hex, e.g., \"000000\") |\n| `alignment` | string | Paragraph alignment: `left`/`center`/`right`/`justify` |\n| `line_spacing_rule` | string | Line spacing mode (see below) |\n| `line_spacing_value` | number | Line spacing value |\n| `first_line_indent` | number | First line indent (in characters) |\n| `left_indent` | float | Left indent (in inches) |\n| `space_before` | number | Space before paragraph (points) |\n| `space_after` | number | Space after paragraph (points) |\n| `numbering_format` | string | Heading numbering format (see below) |\n\n### Line Spacing Modes\n\n| Value | Description |\n|-------|-------------|\n| `single` | Single line spacing |\n| `1.5` | 1.5 line spacing |\n| `double` | Double line spacing |\n| `multiple` | Multiple line spacing (use `line_spacing_value` as multiplier) |\n| `exact` | Exact line spacing (use `line_spacing_value` in points) |\n| `at_least` | Minimum line spacing (use `line_spacing_value` in points) |\n\n### Numbering Formats\n\n| Format | Example |\n|--------|---------|\n| `chapter` | 第一章, 第二章, 第三章... |\n| `section` | 第一节, 第二节, 第三节... |\n| `chinese` | 一、二、三... |\n| `chinese_paren` | （一）（二）（三）... |\n| `arabic` | 1. 2. 3... |\n| `arabic_paren` | (1) (2) (3)... |\n| `arabic_bracket` | [1] [2] [3]... |\n| `roman` | I. II. III... |\n| `roman_lower` | i. ii. iii... |\n| `letter` | A. B. C... |\n| `letter_lower` | a. b. c... |\n| `circle` | ① ② ③... |\n| `none` | No numbering |\n\nCustom format strings are also supported using `{n}` for Arabic numbers and `{cn}` for Chinese numbers.\n\n### Table Configuration\n\nConfigure table appearance in the `table` section:\n\n```json\n{\n    \"table\": {\n        \"border_style\": \"single\",\n        \"border_color\": \"000000\",\n        \"border_width\": 4,\n        \"header_background_color\": \"D9E2F3\",\n        \"cell_background_color\": null,\n        \"alternating_row_color\": \"F2F2F2\",\n        \"cell_padding_top\": 2,\n        \"cell_padding_bottom\": 2,\n        \"cell_padding_left\": 5,\n        \"cell_padding_right\": 5,\n        \"width_mode\": \"full\",\n        \"width_inches\": null\n    }\n}\n```\n\n| Property | Type | Description |\n|----------|------|-------------|\n| `border_style` | string | Border style: `single`/`double`/`dotted`/`dashed`/`none` |\n| `border_color` | string | Border color (hex, e.g., \"000000\") |\n| `border_width` | number | Border width in 1/8 points (4 = 0.5pt, 8 = 1pt) |\n| `header_background_color` | string | Header row background color (hex) |\n| `cell_background_color` | string | Cell background color (hex) |\n| `alternating_row_color` | string | Alternating row color for zebra striping (hex) |\n| `cell_padding_*` | number | Cell padding in points (top/bottom/left/right) |\n| `width_mode` | string | Table width mode: `auto`/`full`/`fixed` |\n| `width_inches` | number | Fixed width in inches (when `width_mode` is \"fixed\") |\n\n### Chinese Font Sizes\n\n| Name | Points | Name | Points |\n|------|--------|------|--------|\n| 初号 | 42 | 小初 | 36 |\n| 一号 | 26 | 小一 | 24 |\n| 二号 | 22 | 小二 | 18 |\n| 三号 | 16 | 小三 | 15 |\n| 四号 | 14 | 小四 | 12 |\n| 五号 | 10.5 | 小五 | 9 |\n| 六号 | 7.5 | 小六 | 6.5 |\n| 七号 | 5.5 | 八号 | 5 |\n\n## Requirements\n\n- Python \u003e= 3.10\n- markdown2\n- python-docx\n- html-for-docx\n- httpx\n- Pillow\n- latex2mathml\n- mathml2omml\n- lxml\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandersonby%2Fmd2word","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandersonby%2Fmd2word","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandersonby%2Fmd2word/lists"}