Skip to content

Commit 11b5dd4

Browse files
committed
Update readme
1 parent 67010df commit 11b5dd4

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

readme.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* [What is this?](#what-is-this)
1616
* [When to use this](#when-to-use-this)
1717
* [Install](#install)
18+
* [Replacing the official package](#replacing-the-official-package)
19+
* [Standard Installation](#standard-installation)
1820
* [Use](#use)
1921
* [API](#api)
2022
* [`math(options?)`](#mathoptions)
@@ -59,6 +61,56 @@ making it easier to transform content by abstracting these internals away.
5961

6062
## Install
6163

64+
### Replacing the official package
65+
66+
If you are using another tool (such as `remark-math`) that depends on the original `micromark-extension-math`, you will need to tell your build tool or package manager to use this package (`micromark-extension-cfm-math`) instead.
67+
68+
#### With Vite
69+
70+
In your `vite.config.js` (or `vite.config.ts`), you can use the `resolve.alias` option:
71+
72+
```js
73+
import { defineConfig } from 'vite'
74+
75+
export default defineConfig({
76+
// ...
77+
resolve: {
78+
alias: {
79+
'micromark-extension-math': 'micromark-extension-cfm-math'
80+
}
81+
}
82+
})
83+
```
84+
85+
#### With Package Manager Overrides
86+
87+
A more robust method is to use the overrides feature of your package manager. This forces the dependency resolution to always use your preferred version, regardless of how deep it is in the dependency tree.
88+
89+
* **For npm (v8.3.0+):** add this to your `package.json`:
90+
```json
91+
"overrides": {
92+
"micromark-extension-math": "npm:micromark-extension-cfm-math@^3"
93+
}
94+
```
95+
* **For pnpm:** add this to your `package.json`:
96+
```json
97+
"pnpm": {
98+
"overrides": {
99+
"micromark-extension-math": "npm:micromark-extension-cfm-math@^3"
100+
}
101+
}
102+
```
103+
* **For Yarn (v1 Classic and v2+ Modern):** add this to your `package.json`:
104+
```json
105+
"resolutions": {
106+
"micromark-extension-math": "npm:micromark-extension-cfm-math@^3"
107+
}
108+
```
109+
110+
After adding this, delete your `node_modules` directory and lock file (`package-lock.json`, `pnpm-lock.yaml`, or `yarn.lock`), and run install again.
111+
112+
### Standard Installation
113+
62114
This package is [ESM only][esm].
63115
In Node.js (version 16+), install with [npm][]:
64116

0 commit comments

Comments
 (0)