Skip to content

Commit 47ad519

Browse files
authored
Merge pull request #1 from md2docx/image
Image
2 parents 7cf9a75 + f997b40 commit 47ad519

File tree

24 files changed

+576
-2518
lines changed

24 files changed

+576
-2518
lines changed

.github/workflows/manual-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333
working-directory: ./lib
3434
- name: clean up working directory
3535
run: git status && git clean -f -d && git status
36-
# - name: Copy Readme file
37-
# run: cp ./README.md ./lib # todo: uncomment this line while rebranding
36+
- name: Copy Readme file
37+
run: cp ./README.md ./lib # todo: uncomment this line while rebranding
3838
- name: Apply changesets, publish and create release, branches and tags
3939
run: node ./scripts/manual-publish.js
4040
env:

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jobs:
3535
- name: Test
3636
run: pnpm test
3737
working-directory: ./lib
38-
# - name: Copy Readme file
39-
# run: cp ./README.md ./lib # will be uncommented while rebranding
38+
- name: Copy Readme file
39+
run: cp ./README.md ./lib # will be uncommented while rebranding
4040
- name: Apply changesets, publish and create release, branches and tags
4141
run: node ./scripts/publish.js
4242
env:

.tkb

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,6 @@
11
{
22
"scope": "Workspace",
33
"tasks": {
4-
"55DAZwduwTvlaxaJC8hlX": {
5-
"id": "55DAZwduwTvlaxaJC8hlX",
6-
"description": "(Optional) Set up [Deepsource](https://app.deepsource.com/login) for static code analysis",
7-
"columnId": "column-todo"
8-
},
9-
"FDFqCQvLm2mUlnTJ3Gna5": {
10-
"id": "FDFqCQvLm2mUlnTJ3Gna5",
11-
"description": "Push your changes/Create PR and see your library being automatically tested and published",
12-
"columnId": "column-todo"
13-
},
14-
"O1qAByMoxhHOR-a_guL91": {
15-
"id": "O1qAByMoxhHOR-a_guL91",
16-
"description": "Optionally deploy your examples to Vercel.",
17-
"columnId": "column-todo"
18-
},
19-
"0499BqWDwJ5cxqtC9Nr82": {
20-
"id": "0499BqWDwJ5cxqtC9Nr82",
21-
"description": "Feel free to star this template, contribute, and/or sponsor the [`terborepo-template`](https://github.com/md2docx/md2docx-plugin-template) project or my [other open-source work](https://github.com/sponsors/mayank1513)",
22-
"columnId": "column-todo"
23-
},
24-
"IjuAtNquJ4-Ut874rHKIW": {
25-
"id": "IjuAtNquJ4-Ut874rHKIW",
26-
"description": "You can also fork the [`terborepo-template`](https://github.com/md2docx/md2docx-plugin-template/fork) and add your package to `scripts/featured.json`\n - If approved, your package will be automatically added to FEATURED.md and also published on the home page of this repo.",
27-
"columnId": "column-todo"
28-
},
294
"_JiH9RZLmUF5nxD7lBC5B": {
305
"id": "_JiH9RZLmUF5nxD7lBC5B",
316
"description": "Create a new GitHub repository using this template.\n - Click the `Use this template` button at the top right -> `Create a new repository`\n - Click `Create repository` and wait for the setup workflow to finish rebranding your repo.",
@@ -46,13 +21,7 @@
4621
{
4722
"id": "column-todo",
4823
"title": "To do",
49-
"tasksIds": [
50-
"55DAZwduwTvlaxaJC8hlX",
51-
"FDFqCQvLm2mUlnTJ3Gna5",
52-
"O1qAByMoxhHOR-a_guL91",
53-
"0499BqWDwJ5cxqtC9Nr82",
54-
"IjuAtNquJ4-Ut874rHKIW"
55-
]
24+
"tasksIds": []
5625
},
5726
{
5827
"id": "column-doing",
@@ -69,4 +38,4 @@
6938
]
7039
}
7140
]
72-
}
41+
}

README.md

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,81 @@
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
22

3-
[![test](https://github.com/md2docx/md2docx-plugin-template/actions/workflows/test.yml/badge.svg)](https://github.com/md2docx/md2docx-plugin-template/actions/workflows/test.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/aa896ec14c570f3bb274/maintainability)](https://codeclimate.com/github/md2docx/md2docx-plugin-template/maintainability) [![codecov](https://codecov.io/gh/md2docx/md2docx-plugin-template/graph/badge.svg)](https://codecov.io/gh/md2docx/md2docx-plugin-template) [![Version](https://img.shields.io/npm/v/@m2d/emoji.svg?colorB=green)](https://www.npmjs.com/package/@m2d/emoji) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/d18m/@m2d/emoji.svg)](https://www.npmjs.com/package/@m2d/emoji) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@m2d/emoji)
3+
[![test](https://github.com/md2docx/image/actions/workflows/test.yml/badge.svg)](https://github.com/md2docx/image/actions/workflows/test.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/aa896ec14c570f3bb274/maintainability)](https://codeclimate.com/github/md2docx/image/maintainability) [![codecov](https://codecov.io/gh/md2docx/image/graph/badge.svg)](https://codecov.io/gh/md2docx/image) [![Version](https://img.shields.io/npm/v/@m2d/image.svg?colorB=green)](https://www.npmjs.com/package/@m2d/image) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/d18m/@m2d/image.svg)](https://www.npmjs.com/package/@m2d/image) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@m2d/image)
44

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`
66
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.
98

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+
---
2110

22-
✅ Prettier and linter configured according to modern best practices (Feel free to add your flavor)
11+
## ✨ Features
2312

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
2517

26-
✅ Test setup with Vitest - A modern and fast testing framework supporting Jest-like APIs
18+
---
2719

28-
✅ Workflows to automate testing on every pull-request or code push event
20+
## 📦 Installation
2921

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+
```
3125

32-
✅ Workflow to automatically rebrand the entire template based on your repository name. (Refer [TODO.md](./TODO.md))
26+
**_or_**
3327

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+
```
3531

36-
</details>
32+
**_or_**
3733

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+
```
3937

4038
---
4139

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
4541

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.
4743

48-
For detailed instructions and a checklist, please refer to [TODO.md](./TODO.md).
44+
---
4945

50-
### 🤩 Don't forget to star [this repository](https://github.com/react18-tools/turborepo-template)!
46+
## 🔍 Emoji Support
5147

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.
5349

5450
---
5551

56-
### 🧰 Helpful References
52+
## 🛠️ Development
5753

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+
```
6263

6364
---
6465

65-
### 💡 Derive Ideas from existing Plugins
66+
## 📄 License
6667

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.
7169

7270
---
7371

74-
### 🙌 Contribute
72+
## ⭐ Support Us
7573

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:
7775

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)
7978

80-
<hr />
79+
---
8180

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>

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ Note: We only accept pull requests addressing security vulnerabilities. Addition
2020

2121
## Reporting Vulnerabilities
2222

23-
Kindly report vulnerabilities [here](https://github.com/md2docx/md2docx-plugin-template/security/advisories/new).
23+
Kindly report vulnerabilities [here](https://github.com/md2docx/image/security/advisories/new).

TODO.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
- [ ] Install dependencies using `pnpm`
1313
- Run `pnpm i` to install dependencies
1414
- [ ] Make sure you run `pnpm rebrand` from the root directory to rebrand your repo.
15-
- [ ] 🌟 Enable [private vulnerability reporting]
15+
- [ ] 🌟 Enable [private vulnerability reporting](https://github.com/md2docx/image/security)
1616
- [ ] Set up `CodeCov`
1717
- Visit Codecov and set up your repo
18-
- Create [repository secret] for `CODECOV_TOKEN`
18+
- Create [repository secret]((https://github.com/md2docx/image/settings/secrets/actions)) for `CODECOV_TOKEN`
1919
- [ ] Set up `CodeClimate`
2020
- Visit CodeClimate and set up your repo
21-
- Create [repository secret] for `CC_TEST_REPORTER_ID`
21+
- Create [repository secret]((https://github.com/md2docx/image/settings/secrets/actions)) for `CC_TEST_REPORTER_ID`
2222
- Add `*.test.*` to ignore patterns on the website
2323
- Update Code Climate badge
2424
- [ ] Add `NPM_AUTH_TOKEN` to repository secrets to automate package publishing

examples/nextjs/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"dependencies": {
1515
"@m2d/core": "latest",
16-
"@m2d/emoji": "workspace:*",
16+
"@m2d/emoji": "latest",
1717
"@repo/shared": "workspace:*",
1818
"mdast2docx": "0.3.0",
1919
"next": "^15.2.3",
@@ -27,7 +27,8 @@
2727
"remark-math": "^6.0.0",
2828
"remark-parse": "^11.0.0",
2929
"unified": "^11.0.5",
30-
"webgl-generative-particles": "^0.0.1"
30+
"webgl-generative-particles": "^0.0.1",
31+
"@m2d/image": "workspace:*"
3132
},
3233
"devDependencies": {
3334
"@next/eslint-plugin-next": "^15.2.3",
@@ -38,4 +39,4 @@
3839
"@types/react-dom": "^19.0.4",
3940
"typescript": "^5.8.2"
4041
}
41-
}
42+
}

examples/vite/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"react18-loaders": "latest",
2121
"react18-themes": "^3.2.0",
2222
"@m2d/core": "latest",
23-
"@m2d/emoji": "workspace:*"
23+
"@m2d/emoji": "latest",
24+
"@m2d/image": "workspace:*"
2425
},
2526
"devDependencies": {
2627
"@repo/eslint-config": "workspace:*",
@@ -31,4 +32,4 @@
3132
"typescript": "^5.8.2",
3233
"vite": "^6.2.2"
3334
}
34-
}
35+
}

lib/CHANGELOG.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)