Skip to content

Commit

Permalink
chore(release): prepare for release v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sjwall committed Aug 22, 2022
1 parent 2ef7e6a commit efc6116
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 1 deletion.
85 changes: 85 additions & 0 deletions doc/versioned_docs/version-1.3.0/examples.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
sidebar_position: 2
---

# Examples

The documentation for this library is a working example.

This file, for example, has a diagram using the component and code block.

## Component

```jsx title="Component example"
import { Mermaid } from 'mdx-mermaid/Mermaid'

<Mermaid chart={`sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts <br/>prevail!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!`} />
```

<Mermaid chart={`sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts <br/>prevail!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!`} />

## Code block

The component doesn't need to be imported as this will be auto inserted.

````md title="Code block example"
```mermaid
gantt
dateFormat YYYY-MM-DD
title Adding GANTT diagram to mermaid
excludes weekdays 2014-01-10

section A section
Completed task :done, des1, 2014-01-06,2014-01-08
Active task :active, des2, 2014-01-09, 3d
Future task : des3, after des2, 5d
Future task2 : des4, after des3, 5d
```
````

```mermaid
gantt
dateFormat YYYY-MM-DD
title Adding GANTT diagram to mermaid
excludes weekdays 2014-01-10
section A section
Completed task :done, des1, 2014-01-06,2014-01-08
Active task :active, des2, 2014-01-09, 3d
Future task : des3, after des2, 5d
Future task2 : des4, after des3, 5d
```

## Mermaid Config

Mermaid config can be configured through the plugin config:

```js title=docusaurus.config.js
remarkPlugins: [[await import('mdx-mermaid').default, { mermaid: { theme: 'dark' } }]],
```

:::caution

When passing config to the `<Mermaid>` component only the first instance should have the config passed to it.
If no config is passed to any component then Mermaid will not initialize.
This is not an issue when using in `.mdx` files as the parser will handle this.
75 changes: 75 additions & 0 deletions doc/versioned_docs/version-1.3.0/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
sidebar_position: 1
---

# Tutorial

Setup mdx-mermaid in Docusaurus.

## Installing

Use your preferred package manager to install.

```shell title=NPM
npm i mdx-mermaid@^1.3.0 mermaid
```

```shell title=Yarn
yarn add mdx-mermaid@^1.3.0 mermaid
```

```shell title=PNPM
pnpm add mdx-mermaid@^1.3.0 mermaid
```

## Configure in Docusaurus

Import the module and pass it to `remarkPlugins`:

```js title=docusaurus.config.js

async function createConfig() {
const mdxMermaid = await import('mdx-mermaid')

return {
presets: [
[
'classic',
{
docs: {
remarkPlugins: [mdxMermaid.default],
}
}
]
]
}
}

module.exports = createConfig;
```

## Add a Diagram

Add a Mermaid diagram to a `.md` or `.mdx` file.

````md title="Example Mermaid diagram"
```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```
````

## Admire your diagram

Take the time to appreciate your diagram.

```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```
11 changes: 11 additions & 0 deletions doc/versioned_docs/version-1.3.0/mermaid-versions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
sidebar_position: 4
---

# Supported Mermaid versions

This library supports Mermaid versions `>= 8.11.0`

The version needs to be at least `8.11.0` due to this issue: https://github.com/sjwall/mdx-mermaid/issues/20

To use Mermaid versions `>=8.12.0` ESM must be used, due to the `d3` version upgrade to modules https://github.com/mermaid-js/mermaid/issues/2559
27 changes: 27 additions & 0 deletions doc/versioned_docs/version-1.3.0/theme.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
sidebar_position: 3
---

# Theme

The theme can be changed between dark and light themes by setting `theme` values in the configuration:

```js title=docusaurus.config.js
remarkPlugins: [[await import('mdx-mermaid'), {
theme: { light: 'neutral', dark: 'forest' }
}]],
```

Toggle the theme in the top right corner to change this diagrams theme between `neutral` and `forest`:

<Mermaid chart={`sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts <br/>prevail!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!`} config={ { theme: { light: 'neutral', dark: 'forest' } } } />
8 changes: 8 additions & 0 deletions doc/versioned_sidebars/version-1.3.0-sidebars.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"tutorialSidebar": [
{
"type": "autogenerated",
"dirName": "."
}
]
}
1 change: 1 addition & 0 deletions doc/versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[
"1.3.0",
"1.2.3"
]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mdx-mermaid",
"version": "1.2.3",
"version": "1.3.0",
"description": "Display mermaid diagrams in mdx files.",
"types": "index.d.ts",
"main": "lib/mdxast-mermaid.js",
Expand Down

0 comments on commit efc6116

Please sign in to comment.