{"id":27002957,"url":"https://github.com/md2docx/html","last_synced_at":"2025-04-04T05:14:33.888Z","repository":{"id":284398565,"uuid":"954706353","full_name":"md2docx/html","owner":"md2docx","description":"Parses embedded **HTML** into extended **MDAST nodes** to unlock full HTML-to-DOCX conversion support.","archived":false,"fork":false,"pushed_at":"2025-04-02T01:51:45.000Z","size":684,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T02:38:14.152Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/md2docx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["md2docx","mayank1513"],"polar":"mayank1513","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://pages.razorpay.com/mayank1513"]}},"created_at":"2025-03-25T13:48:27.000Z","updated_at":"2025-04-02T01:51:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"f74c10b4-b81e-4c4c-8c5b-e99a1ae40618","html_url":"https://github.com/md2docx/html","commit_stats":null,"previous_names":["md2docx/html"],"tags_count":2,"template":false,"template_full_name":"md2docx/md2docx-plugin-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/md2docx%2Fhtml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/md2docx%2Fhtml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/md2docx%2Fhtml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/md2docx%2Fhtml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/md2docx","download_url":"https://codeload.github.com/md2docx/html/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247123086,"owners_count":20887261,"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":[],"created_at":"2025-04-04T05:14:33.147Z","updated_at":"2025-04-04T05:14:33.881Z","avatar_url":"https://github.com/md2docx.png","language":"TypeScript","funding_links":["https://github.com/sponsors/md2docx","https://github.com/sponsors/mayank1513","https://polar.sh/mayank1513","https://pages.razorpay.com/mayank1513"],"categories":[],"sub_categories":[],"readme":"# `@m2d/html` \u003cimg src=\"https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png\" height=\"40\"/\u003e\n\n[![Version](https://img.shields.io/npm/v/@m2d/html?color=green)](https://www.npmjs.com/package/@m2d/html) ![Downloads](https://img.shields.io/npm/d18m/@m2d/html) ![Bundle Size](https://img.shields.io/bundlephobia/minzip/@m2d/html)\n\n\u003e Parses embedded **HTML** into extended **MDAST nodes** to unlock full HTML-to-DOCX conversion support.\n\n---\n\n## 📦 Installation\n\n```bash\nnpm install @m2d/html\n```\n\n```bash\npnpm add @m2d/html\n```\n\n```bash\nyarn add @m2d/html\n```\n\n---\n\n## 🚀 Overview\n\nThe `@m2d/html` plugin for [`mdast2docx`](https://github.com/mayankchaudhari/mdast2docx) enables the parsing and transformation of **embedded raw HTML** inside Markdown into **extended MDAST**. This unlocks the ability to support features like images, tables, checkboxes, styles, and more — using HTML tags directly inside your Markdown documents.\n\n---\n\n## ⚠️ Important\n\n\u003e **This plugin must be registered early in the plugin pipeline.**  \n\u003e It transforms raw HTML into extended MDAST nodes, which are then handled by other `@m2d/*` plugins (such as `@m2d/image`, `@m2d/table`, etc).  \n\u003e If used after other plugins, the HTML content, e.g, images, tables, or lists may be ignored or lost in the DOCX output.\n\n---\n\n## 🛠️ Usage\n\n```ts\nimport { htmlPlugin } from \"@m2d/html\";\n\nconst plugins = [\n  htmlPlugin(), // ✅ Must come first\n  imagePlugin(),\n  tablePlugin(),\n];\n```\n\n---\n\n## 🧩 How It Works\n\n1. Parses raw embedded HTML using the DOM.\n2. Converts DOM nodes to extended MDAST nodes.\n3. Other `@m2d/*` plugins or the `@m2d/core` package consume these extended nodes to generate DOCX output.\n\n\u003e This plugin enriches the AST to enable other plugins and core engine to convert it to docx.\n\n---\n\n## ✅ Supported Elements\n\n| HTML Element              | MDAST Node        | Notes                                |\n| ------------------------- | ----------------- | ------------------------------------ |\n| `\u003cimg\u003e`                   | `image`           | Supports styles and attributes       |\n| `\u003cbr\u003e`                    | `break`           | Line breaks                          |\n| `\u003cstrong\u003e`, `\u003cb\u003e`         | `strong`          | Bold text                            |\n| `\u003cem\u003e`, `\u003ci\u003e`             | `emphasis`        | Italics                              |\n| `\u003cdel\u003e`, `\u003cs\u003e`            | `delete`          | Strike-through                       |\n| `\u003ca\u003e`                     | `link`            | Hyperlinks                           |\n| `\u003ctable\u003e`                 | `table`, `row`    | Basic tables supported               |\n| `\u003cinput type=\"checkbox\"\u003e` | `checkbox`        | Readonly checkboxes                  |\n| `\u003chr\u003e`                    | `thematicBreak`   | Horizontal line                      |\n| `\u003cblockquote\u003e`            | `blockquote`      | Blockquotes                          |\n| Others                    | `paragraph`, etc. | Styled or inline nodes with rich AST |\n\n---\n\n## 🎨 Style Support\n\n- `text-align`, `color`, `background-color`\n- `font-weight`, `font-style`, `text-decoration`\n- `text-transform`\n- `border`, `border-left`, etc.\n- `display: inline-block` and similar behaviors\n\n---\n\n## ⚠️ Limitations\n\n- External `\u003cstyle\u003e` tags or CSS files are not supported.\n- Complex or deeply nested HTML may be simplified.\n- Table `rowSpan` and `colSpan` are not yet supported.\n- Script tags and non-visual elements are ignored.\n\n---\n\n## 🧪 Production Ready\n\nWhile this plugin was originally experimental, it is now **stable and production-ready**.  \nIt powers the rich HTML support in `mdast2docx`, including checkboxes, tables, and styled images.\n\n\u003e 🧵 **Contributions, ideas, and feedback are welcome!** Open an issue or PR anytime.\n\n---\n\n## 🔌 Related Plugins/Packages\n\n| Plugin                                               | Purpose                                |\n| ---------------------------------------------------- | -------------------------------------- |\n| [`@m2d/core`](https://npmjs.com/package/@m2d/core)   | Converts extended MDAST to DOCX        |\n| [`@m2d/image`](https://npmjs.com/package/@m2d/image) | Renders image nodes to DOCX            |\n| [`@m2d/table`](https://npmjs.com/package/@m2d/table) | Renders table nodes to DOCX            |\n| [`@m2d/list`](https://npmjs.com/package/@m2d/list)   | Enhanced list support (tasks, bullets) |\n\n---\n\n## ⭐ Support Us\n\nIf you find this useful:\n\n- ⭐ Star [mdast2docx](https://github.com/tiny-md/mdast2docx) on GitHub\n- ❤️ Consider [sponsoring](https://github.com/sponsors/mayank1513)\n\n---\n\n## 🧾 License\n\nMIT © [Mayank Chaudhari](https://github.com/mayankchaudhari)\n\n\u003cp align=\"center\"\u003eMade with 💖 by \u003ca href=\"https://mayank-chaudhari.vercel.app\" target=\"_blank\"\u003eMayank Kumar Chaudhari\u003c/a\u003e\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmd2docx%2Fhtml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmd2docx%2Fhtml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmd2docx%2Fhtml/lists"}