forked from mermaid-js/mermaid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new doc for registering icon pack in mermaid
- Loading branch information
1 parent
351ce30
commit 9f6f1e9
Showing
7 changed files
with
109 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
> **Warning** | ||
> | ||
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. | ||
> | ||
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/icons.md](../../packages/mermaid/src/docs/config/icons.md). | ||
# Registering icon pack in mermaid | ||
|
||
The icon packs available can be found at [icones.js.org](https://icones.js.org/). | ||
We use the name defined when registering the icon pack, to override the prefix field of the iconify pack. This allows the user to use shorter names for the icons. It also allows us to load a particular pack only when it is used in a diagram. | ||
|
||
Using JSON file directly from CDN: | ||
|
||
```js | ||
import mermaid from 'CDN/mermaid.esm.mjs'; | ||
mermaid.registerIconPacks([ | ||
{ | ||
name: 'logos', | ||
loader: () => | ||
fetch('https://unpkg.com/@iconify-json/logos/icons.json').then((res) => res.json()), | ||
}, | ||
]); | ||
``` | ||
|
||
Using packages and a bundler: | ||
|
||
```bash | ||
npm install @iconify-json/logos | ||
``` | ||
|
||
With lazy loading | ||
|
||
```js | ||
import mermaid from 'mermaid'; | ||
|
||
mermaid.registerIconPacks([ | ||
{ | ||
name: 'logos', | ||
loader: () => import('@iconify-json/logos').then((module) => module.icons), | ||
}, | ||
]); | ||
``` | ||
|
||
Without lazy loading | ||
|
||
```js | ||
import mermaid from 'mermaid'; | ||
import { icons } from '@iconify-json/logos'; | ||
mermaid.registerIconPacks([ | ||
{ | ||
name: icons.prefix, // To use the prefix defined in the icon pack | ||
icons, | ||
}, | ||
]); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Registering icon pack in mermaid | ||
|
||
The icon packs available can be found at [icones.js.org](https://icones.js.org/). | ||
We use the name defined when registering the icon pack, to override the prefix field of the iconify pack. This allows the user to use shorter names for the icons. It also allows us to load a particular pack only when it is used in a diagram. | ||
|
||
Using JSON file directly from CDN: | ||
|
||
```js | ||
import mermaid from 'CDN/mermaid.esm.mjs'; | ||
mermaid.registerIconPacks([ | ||
{ | ||
name: 'logos', | ||
loader: () => | ||
fetch('https://unpkg.com/@iconify-json/logos/icons.json').then((res) => res.json()), | ||
}, | ||
]); | ||
``` | ||
|
||
Using packages and a bundler: | ||
|
||
```bash | ||
npm install @iconify-json/logos | ||
``` | ||
|
||
With lazy loading | ||
|
||
```js | ||
import mermaid from 'mermaid'; | ||
|
||
mermaid.registerIconPacks([ | ||
{ | ||
name: 'logos', | ||
loader: () => import('@iconify-json/logos').then((module) => module.icons), | ||
}, | ||
]); | ||
``` | ||
|
||
Without lazy loading | ||
|
||
```js | ||
import mermaid from 'mermaid'; | ||
import { icons } from '@iconify-json/logos'; | ||
mermaid.registerIconPacks([ | ||
{ | ||
name: icons.prefix, // To use the prefix defined in the icon pack | ||
icons, | ||
}, | ||
]); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters