|
1 | | -## 🧩 Plugin Template for `mdast2docx` & `@m2d/remark-docx` <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 40px"/> |
| 1 | +# @m2d/image |
2 | 2 |
|
3 | | -[](https://github.com/md2docx/md2docx-plugin-template/actions/workflows/test.yml) [](https://codeclimate.com/github/md2docx/md2docx-plugin-template/maintainability) [](https://codecov.io/gh/md2docx/md2docx-plugin-template) [](https://www.npmjs.com/package/@m2d/emoji) [](https://www.npmjs.com/package/@m2d/emoji)  |
| 3 | +[](https://github.com/md2docx/image/actions/workflows/test.yml) [](https://codeclimate.com/github/md2docx/image/maintainability) [](https://codecov.io/gh/md2docx/image) [](https://www.npmjs.com/package/@m2d/image) [](https://www.npmjs.com/package/@m2d/image)  |
4 | 4 |
|
5 | | -> This repository serves as a starting point for building plugins that extend the functionality of [`mdast2docx`](https://www.npmjs.com/package/mdast2docx), [`@m2d/core`](https://www.npmjs.com/package/@m2d/core) and [`@m2d/remark-docx`](https://www.npmjs.com/package/@m2d/remark-docx). |
| 5 | +> Emoji shortcode support for `mdast2docx` |
6 | 6 |
|
7 | | -<details> |
8 | | -<summary style="cursor:pointer"><h2 style="display:inline-block">Features</h2></summary> |
| 7 | +This plugin adds support for emoji shortcodes (e.g., `:smile:`, `:rocket:`) in your Markdown-to-DOCX conversion pipeline. It replaces recognized emoji shortcodes with their corresponding Unicode characters during the MDAST transformation. |
9 | 8 |
|
10 | | -This template offers the following pre-configured features. Additionally, your repository will automatically be re-branded with the help of workflows and post-install scripts. |
11 | | - |
12 | | -✅ Monorepo powered by Turborepo and GitHub actions for automating building, testing, and deploying your plugin library |
13 | | - |
14 | | -✅ Examples with Next.js, and Vite to showcase how your library can be utilized, also helps in quick manual testing |
15 | | - |
16 | | -✅ Examples pre-configured for Light/Dark theme based on user preference |
17 | | - |
18 | | -✅ Examples ready to be deployed to Vercel |
19 | | - |
20 | | -✅ Code of Conduct and contributing files, ready for customization |
| 9 | +--- |
21 | 10 |
|
22 | | -✅ Prettier and linter configured according to modern best practices (Feel free to add your flavor) |
| 11 | +## ✨ Features |
23 | 12 |
|
24 | | -✅ Recommended VSCode extensions - Prettier and [Kanban board](https://github.com/mayank1513/vscode-extension-trello-kanban-board) for code formatting and project management directly within your IDE |
| 13 | +- Converts emoji shortcodes to Unicode emojis (e.g., `:tada:` → 🎉) |
| 14 | +- Compatible with [`@m2d/core`](https://www.npmjs.com/package/@m2d/core) |
| 15 | +- Works seamlessly within the `mdast2docx` plugin ecosystem |
| 16 | +- Easy to integrate and lightweight |
25 | 17 |
|
26 | | -✅ Test setup with Vitest - A modern and fast testing framework supporting Jest-like APIs |
| 18 | +--- |
27 | 19 |
|
28 | | -✅ Workflows to automate testing on every pull-request or code push event |
| 20 | +## 📦 Installation |
29 | 21 |
|
30 | | -✅ Workflow to automatically publish and create GitHub releases when you update your library's `package.json` file. |
| 22 | +```bash |
| 23 | +pnpm install @m2d/image |
| 24 | +``` |
31 | 25 |
|
32 | | -✅ Workflow to automatically rebrand the entire template based on your repository name. (Refer [TODO.md](./TODO.md)) |
| 26 | +**_or_** |
33 | 27 |
|
34 | | -✅ Plus, this repo includes a quick checklist for configuring Codecov and other badges, setting up your docs website on GitHub pages, and more. See [Checklist](./TODO.md) or open TKB(Workspace) if you have installed the Trello-Kanban-Board extension. |
| 28 | +```bash |
| 29 | +yarn add @m2d/image |
| 30 | +``` |
35 | 31 |
|
36 | | -</details> |
| 32 | +**_or_** |
37 | 33 |
|
38 | | -> <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 20px"/> Star [this repository](https://github.com/md2docx/md2docx-plugin-template) and share it with your friends. |
| 34 | +```bash |
| 35 | +npm add @m2d/image |
| 36 | +``` |
39 | 37 |
|
40 | 38 | --- |
41 | 39 |
|
42 | | -## Getting Started: |
43 | | - |
44 | | -This template is based on [Turborepo Template](https://github.com/react18-tools/turborepo-template/). But this one is optimized for md2docx plugins. It includes pre-configured unit-tests, a lot of extra stuff provided by the turborepo-template is removed, and comes with dependencies and scripts optimized for md2docx plugin development. |
| 40 | +## 🧠 How It Works |
45 | 41 |
|
46 | | -To get started, simply click on the `"Use this template"` button to create a new repository based on this template, and install dependencies. Customize it according to your requirements for your next md2docx plugin. |
| 42 | +This plugin scans all text nodes for emoji shortcodes (e.g., `:fire:`, `:sparkles:`) and replaces them with matching Unicode emojis using a predefined emoji JSON mapping. |
47 | 43 |
|
48 | | -For detailed instructions and a checklist, please refer to [TODO.md](./TODO.md). |
| 44 | +--- |
49 | 45 |
|
50 | | -### 🤩 Don't forget to star [this repository](https://github.com/react18-tools/turborepo-template)! |
| 46 | +## 🔍 Emoji Support |
51 | 47 |
|
52 | | -Looking for a hands-on course to get started with Turborepo? Check out [React and Next.js with TypeScript](https://mayank-chaudhari.vercel.app/courses/react-and-next-js-with-typescript) and [The Game of Chess with Next.js, React, and TypeScript](https://www.udemy.com/course/game-of-chess-with-nextjs-react-and-typescript/?referralCode=851A28F10B254A8523FE) |
| 48 | +It uses the [GitHub-style emoji shortcodes](https://github.com/ikatyang/emoji-cheat-sheet) and more — if a shortcode is not recognized, it will remain unchanged. |
53 | 49 |
|
54 | 50 | --- |
55 | 51 |
|
56 | | -### 🧰 Helpful References |
| 52 | +## 🛠️ Development |
57 | 53 |
|
58 | | -- [`@m2d/core`](https://www.npmjs.com/package/@m2d/core) – Core MDAST to DOCX engine |
59 | | -- [`@m2d/remark-docx`](https://www.npmjs.com/package/@m2d/remark-docx) – Remark plugin |
60 | | -- [Unified Ecosystem](https://unifiedjs.com) – AST-based processors for markdown, html, etc. |
61 | | -- [MDAST Spec](https://github.com/syntax-tree/mdast) – Markdown Abstract Syntax Tree |
| 54 | +```bash |
| 55 | +# Clone and install dependencies |
| 56 | +git clone https://github.com/md2docx/emoji-plugin |
| 57 | +cd emoji-plugin |
| 58 | +npm install |
| 59 | + |
| 60 | +# Build / Test / Dev |
| 61 | +npm run build |
| 62 | +``` |
62 | 63 |
|
63 | 64 | --- |
64 | 65 |
|
65 | | -### 💡 Derive Ideas from existing Plugins |
| 66 | +## 📄 License |
66 | 67 |
|
67 | | -- `@m2d/math`: Parse math blocks and convert to equation DOCX |
68 | | -- `@m2d/image`: Convert Markdown/HTML images to inline DOCX images |
69 | | -- `@m2d/html`: Parse raw HTML into extended MDAST with styles |
70 | | -- `@m2d/table`: Advanced table support with merged cells, widths, styles |
| 68 | +Licensed under the **MPL-2.0** License. |
71 | 69 |
|
72 | 70 | --- |
73 | 71 |
|
74 | | -### 🙌 Contribute |
| 72 | +## ⭐ Support Us |
75 | 73 |
|
76 | | -If you’re building a plugin you'd like to share, let us know or open a PR in the [mdast2docx plugins repo](https://github.com/m2djs/mdast2docx)! |
| 74 | +If you find this useful: |
77 | 75 |
|
78 | | -> <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 20px"/> Enrolling in [our courses](https://mayank-chaudhari.vercel.app/courses) or [sponsor](https://github.com/sponsors/mayank1513) our work. |
| 76 | +- ⭐ Star [mdast2docx](https://github.com/md2docx/mdast2docx) on GitHub |
| 77 | +- ❤️ Consider [sponsoring](https://github.com/sponsors/mayank1513) |
79 | 78 |
|
80 | | -<hr /> |
| 79 | +--- |
81 | 80 |
|
82 | | -<p align="center" style="text-align:center">with 💖 by <a href="https://mayank-chaudhari.vercel.app" target="_blank">Mayank Kumar Chaudhari</a></p> |
| 81 | +<p align="center">Made with 💖 by <a href="https://mayank-chaudhari.vercel.app" target="_blank">Mayank Kumar Chaudhari</a></p> |
0 commit comments