Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use JSON Schema to define and document MermaidConfig #4112

Merged

Conversation

aloisklink
Copy link
Member

@aloisklink aloisklink commented Feb 20, 2023

📑 Summary

Currently, the MermaidConfig definition is a bit broken.

This PR proposes instead moving as much as possible into a JSON Schema definition.

From a JSON Schema file, we can:

  • Automatically generate documentation in markdown, using @adobe/jsonschema2md.
    This has been added in f9d3d53.
  • Automatically generate TypeScript definitions using json-schema-to-typescript.
    • The script to do this has been added in a156446, and is backwards compatible with the old TypeScript definition.
      • For a future version of Mermaid, we probably want to make the MermaidConfig stricter, but that will be a breaking change, so it might need to wait for Mermaid v11.
    • The changed TypeScript file can be found in 1e8d266.
  • Automatically generate default JSON values using ajv.
    • This is done by a custom Vite plugin I wrote in 81b7d74.
    • Non-JSON values like undefined and function are still located in
      defaultConfig.ts.
    • As a temporary measure, I've added a test in 2c7b50f that checks that the old defaultConfig is the same as the new defaultConfig. This test can be git revert-ed once this PR is merged, and there is no risk of merge conflicts.
  • Validate user submitted configuration and print human-readable warnings/errors
    (i.e. like what eslint uses for plugins)
    (not in this PR, since it will be a breaking change).

Before (broken)

Two files to edit (defaultConfig.ts and config.types.ts) with broken documentation.

flowchart TD
    default(defaultConfig.ts) -->|documentation.js **BROKEN**| docs[Documentation]
    configTypes(config.types.ts)
Loading

After

One file to edit (schemas/config.schema.yaml JSON Schema) that auto-generates defaultConfig.ts, config.types.ts, and documentation.

flowchart TD
    schema(schemas/config.schema.yaml JSON Schema)
    schema -->|.vite/jsonSchemaPlugin.ts| default[defaultConfig.ts]
    schema -->|docs.mts using jsonschema2md| docs[Documentation]
    schema --> |create-types-from-json-schema.mjs\nusing json-schema-to-typescript| configTypes(config.types.ts)
Loading

📏 Design Decisions

  • The documentation is generated in the same packages/mermaid/src/docs.mts script as the rest of the markdown documentation. However, I've decided to only put it in Vitepress, and not in the docs/ folder, mainly because it creates 100s of files, which slows down git, and would make this PR massive.
  • I've made sure that the new packages/mermaid/src/config.type.ts definition is backwards compatible with the old one. This however, has some issues:
    • A bunch of types for variables like securityLevel are changed from a string/number to an enum. (e.g. securityLevel type is "strict" | "loose" | "antiscript" | "sandbox"). To ensure backwards compatibility, I've added a | string to them, but in the future, they should probably just be an enum.
    • All the TypeScript properties are optional. Ideally, anything that is documented as required, should be a required type. In the future, we should mark these as required in MermaidConfig, and change functions like setConfig() to only accept a Partial<MermaidConfig>.
    • In order to make the git diff simpler, the script that generates packages/mermaid/src/defaultConfig.ts has some custom code to make sure everything is output in the same order as it was before. We can delete this bit later, once we no longer need to worry about git merge conflicts.
    • The packages/mermaid/scripts/create-types-from-json-schema.mjs script I wrote is a bit hacky.
      • Ideally, we should extract some of the common functions from packages/mermaid/src/docs.mts, so that both of these scripts can re-use the same code and functions.
      • It's also not written in TypeScript, mainly because this script creates the MermaidConfig TypeScript file, but also uses the MermaidConfig TypeScript file. We may want to fix this in the future.
  • packages/mermaid/src/defaultConfig.ts:
    • The JSON default values are automatically generated when running pnpm run build or pnpm run test from the default: keys in the JSON Schema, by the custom .vite/jsonSchemaPlugin.ts file I made, that uses ajv to get the default values.
      • There is a tiny difference in size (~400 bytes), mainly because my custom Vite plugin quotes everything (e.g. it does {"key": "bar"} instead of {key: "bar"}). It's probably not worth changing.
    • Currently, gitGraph.useMaxWidth is undefined. I've changed this to false in my implementation.
      However, every other diagram uses true, so should we also set gitGraph.useMaxWidth to true?
    • A bunch of options have explicit default values of undefined, which isn't a valid JSON type,
      so we can't put their default values into the JSON Schema.
      Can we instead make their default values null?

Generated Documentation Preview

Preview of generated @adobe/jsonschema2md output

Preview of generated @adobe/jsonschema2md output

See https://aloisklink.com/mermaid/config/schema-docs/config.html if you want to explore the docs yourself.

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added unit/e2e tests (if appropriate)
    • E2E tests show that no snapshots have changed.
  • 📓 have added documentation (if appropriate)
  • 🔖 targeted develop branch
    • I've targeted commit fec193e, which is on both develop and release/10.0.0, so that this PR should also merge cleanly into the release/10.0.0 branch.
      However, since this PR is pretty big, it can wait until after v10.0.0, especially since this PR doesn't yet have any breaking changes.

It's probably worth asking most of the core contributors if they'd be comfortable writing in JSON Schema, instead of modifying defaultConfig.ts/config.types.ts.

@sidharthv96
Copy link
Member

This is wonderful. Even the PR description is top-notch!

Nits:
Can this be clickable link? Saw this in all files.
image

Currently, gitGraph.useMaxWidth is undefined. I've changed this to false in my implementation.
However, every other diagram uses true, so should we also set gitGraph.useMaxWidth to true?

Yes.


A bunch of options have explicit default values of undefined, which isn't a valid JSON type,
so we can't put their default values into the JSON Schema.
Can we instead make their default values null?

We'll have to check the impact during runtime. There were checks like typeof x === 'undefined' and x === undefined, which would fail if we use null.

@sidharthv96 sidharthv96 added this to the 10.0.1 milestone Feb 24, 2023
@aloisklink aloisklink force-pushed the add-jsonschema-schema-for-config branch from 7425775 to 430830a Compare February 26, 2023 04:07
@aloisklink
Copy link
Member Author

Git force push changes

I've git rebase-d onto develop to fix merge conflicts (and some PR comments).

You can use the following command to view the changes (GitHub's UI isn't great for viewing the difference between two patch series):

git range-diff fec193ebaf85403e3bc8031d79b4f593a5db1c31..74257756fc7e1fc773aca1c882a47c17c2b80cae  8b5cb75ef70ee1ccc66373cadffae7e5e7425213..430830ada64cc3d8e79fb5c15213f8ca964bbf7b

Main changes:

  • Removed lazyLoadedDiagrams and loadExternalDiagramsAtStartup from the MermaidConfig schema, since 543e4de removed them (these were previously marked as @deprecated anyway.
  • Switched the pnpm run pre-commit script to automatically fix and git add the changes in packages/mermaid/src/config.types.ts (see Use JSON Schema to define and document MermaidConfig #4112 (comment)). Previously, it just threw an error if this file wasn't in sync.
  • Fixed me adding @adobe/jsonschema2md as a devDependency in the wrong commit (doesn't change this PR, but it does make the git history slightly cleaner).
  • Fixed links to schema.json not working. Vitepress apparently doesn't handle .json files properly, so as I work around, I've stuck it into Vitepress's public/ folder, see 430830a

Rely to #4112 (comment)

This is wonderful. Even the PR description is top-notch!

Perhaps it's a bit too wordy though :) Maybe I need to ask ChatGPT to summarize it for me, hahaha. Unfortunately, I couldn't really figure out a way to split this up into smaller PRs.

Nits:
Can this be clickable link? Saw this in all files.
image

The markdown that is generated creates it as a code-block:

```txt
https://mermaid-js.github.io/schemas/config.schema.json
```

To be honest, we could make it into a clickable URL, but I'm not sure we should, since @adobe/jsonschema2md might have a good reason to make it into a code block (feel free to view example @adobe/jsonschema2md output here: https://github.com/adobe/jsonschema2md/blob/main/examples/docs/complex.md).

I think it might be because you're never expected to click on it (it's just an ugly JSON file), it's mainly just used as a unique ID, or for programs to download the schema.

See https://aloisklink.com/mermaid/schemas/config.schema.json for an example of what the file looks like (I've pretty-printed it to make it look nicer). Apparently, Vitepress wasn't bundling .json files properly, so I had to change the script slightly to output it to public/ to get it to appear!

Currently, gitGraph.useMaxWidth is undefined. I've changed this to false in my implementation.
However, every other diagram uses true, so should we also set gitGraph.useMaxWidth to true?

Yes.

Awesome, that will be something to discuss/fix in the next PR (it should be a separate discussion, since previous changes to useMaxWidth have caused issues to the mermaid-cli project, see mermaid-js/mermaid-cli@2c4fd1a)

@sidharthv96 sidharthv96 removed this from the 10.0.1 milestone Feb 28, 2023
@aloisklink
Copy link
Member Author

aloisklink commented Mar 19, 2023

Git force push changes

I've git rebase-d onto develop (aka commit 7647ae3) to fix merge conflicts.

You can use the following command to view the changes (GitHub's UI isn't great for viewing the difference between two patch series):

git range-diff 8b5cb75ef70ee1ccc66373cadffae7e5e7425213..430830ada64cc3d8e79fb5c15213f8ca964bbf7b 7647ae317a7b2130e32777248d25a9c4d24b8f9f..049d1c13d3d91614490bac2d1c023998cc411227

Changes (found by running git diff 8b5cb75ef70ee1ccc66373cadffae7e5e7425213..develop ./packages/mermaid/src/config.type.ts ./packages/mermaid/src/defaultConfig.ts):

  • Added the textPosition option to piechart config (from 82f5b4c)
  • Added nodeSpacing/rankSpacing/diagramPadding/htmlLabels to class diagram config (from 46f2aeb)
    Minor change, I've made htmlLabels default to false instead of undefined
    (this is different from flowchart diagrams, which currently defaults to true).
    Currently undocumented.
  • Added padding option to timeline diagrams (added in 2ab1e15).
    Currently undocumented.

Edit: Fixed broken links and wrong formatting that was making CI fail.

@aloisklink aloisklink force-pushed the add-jsonschema-schema-for-config branch 2 times, most recently from 4a69226 to 049d1c1 Compare March 19, 2023 22:02
@knsv
Copy link
Collaborator

knsv commented Mar 24, 2023

This looks great! Good job @aloisklink!

@aloisklink
Copy link
Member Author

aloisklink commented Mar 25, 2023

I've fixed merge conflicts in the pnpm-lock.yaml file.

It looks like we have a use-inline-specifiers-lockfile-format=true config setting in our .npmrc file that changes the lockfile setting:

use-inline-specifiers-lockfile-format=true

However, renovate seems to ignore this setting, so it's constantly converting our pnpm-lock.yaml file, which causes a bunch of merge conflicts.

Edit: I've made a PR to fix this, see #4249


Is it worth getting a review from @ashishjain0512 too (maybe not a full review, but at least making sure they're okay with using a new method to declare the default values, types, and documentation for MermaidConfig)? They seem to be the main other @mermaid-js member that has edited these files.

@jgreywolf
Copy link
Contributor

What is the status on this?

@aloisklink aloisklink force-pushed the add-jsonschema-schema-for-config branch from dbe5255 to 0477a9f Compare July 3, 2023 06:28
@codecov
Copy link

codecov bot commented Jul 3, 2023

Codecov Report

Merging #4112 (29291c8) into develop (1a4e5d9) will increase coverage by 7.43%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4112      +/-   ##
===========================================
+ Coverage    69.82%   77.26%   +7.43%     
===========================================
  Files          143      143              
  Lines        16489    14455    -2034     
  Branches       518      516       -2     
===========================================
- Hits         11513    11168     -345     
+ Misses        4848     3182    -1666     
+ Partials       128      105      -23     
Flag Coverage Δ
e2e 84.32% <ø> (+16.00%) ⬆️
unit 45.28% <100.00%> (-12.84%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/mermaid/src/defaultConfig.ts 46.81% <100.00%> (-47.02%) ⬇️

... and 41 files with indirect coverage changes

@aloisklink aloisklink force-pushed the add-jsonschema-schema-for-config branch from 0477a9f to 8542365 Compare July 3, 2023 06:47
@aloisklink
Copy link
Member Author

What is the status on this?

Sorry for the delay! Since this is a pretty big PR the changes how the MermaidConfig is defined, fixing merge conflicts is a bit of a pain. IMO, since this PR has been open for a while, I guess anybody who wanted to review it already has. Anybody mind if I go ahead and merge this after PR #4580 gets merged?


I've git rebase-d onto 9c011ab, aka the latest develop branch commit.

git range-diff 7647ae317a7b2130e32777248d25a9c4d24b8f9f..049d1c13d3d91614490bac2d1c023998cc411227 9c011abbd424641172b696c038490a36ec99c518..85423656fe46edc1461893c62d9c01677be4688e

Changes:

  • Improve wording of security level values (from a991c32)
  • Added wrappingWidth to flowchart options (from 4caf7d7)
  • Added quadrant chart options (from Added support for quadrant chart #4383)
    • I've made all options Required, even though the documentation says Optional, since the TypeScript types made them Required.
  • Refactor: Moved Gantt Chart displayMode definition to align with TypeScript position change made in ba1c5dc
  • Added sankey diagram options (from Sankey diagrams #4502)
    • I'll included some of the changes from Remove all TypeScript enums and forbid them in ESLint #4580 to avoid merge conflicts.
    • I've also added some documentation for these options.
    • The default value of useMaxWidth is false for sankey diagrams. However, every other diagram has a useMaxWidth: true default value. Is this correct?

@sidharthv96
Copy link
Member

The default value of useMaxWidth is false for sankey diagrams. However, every other diagram has a useMaxWidth: true default value. Is this correct?

@nirname, feels like it should be true, any reason for setting false as the default?

.vite/jsonSchemaPlugin.ts Outdated Show resolved Hide resolved
.vite/jsonSchemaPlugin.ts Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
packages/mermaid/scripts/create-types-from-json-schema.mjs Outdated Show resolved Hide resolved
packages/mermaid/scripts/create-types-from-json-schema.mjs Outdated Show resolved Hide resolved
packages/mermaid/src/oldDefaultConfig.ts Outdated Show resolved Hide resolved
@Yokozuna59
Copy link
Member

I just want to point out something: these changes would work fine with the current approach, but they're most likely to break or change when applying the stuff discussed in #4499, i.g., moving types from config.types.ts into each diagram types files. #4499 (comment)

Currently, shiki doesn't support code-blocks that use the regexp
language, which means vitepress throws an error on them:

```regexp
^([1-9][0-9]*)(minute|hour|day|week|month)$
```

As a hack until shiki supports them, I've just modified them to get
converted into JavaScript RegEx literal code-blocks, e.g.:

```javascript
/^([1-9][0-9]*)(minute|hour|day|week|month)$/
```
Add a JSON Schema file (in YAML) for the MermaidConfig.

This JSON Schema file follows [JSON Schema 2019-09][1], with some slight
modifications to work with:

- [json-schema-to-typescript][2]
  The `tsType` keyword is used to override the generated TypeScript
  type, when it doesn't match the JSON Schema type.

  This is used in two cases:
    - when the current type cannot be represented in JSON Schema
      (e.g. `FontCalculator`, which is a function)
    - when the JSON Schema type is narrower than the TypeScript type.
      Currently, many enums types are listed as `string` in TypeScript,
      but json-schema-to-typescript converts them to `"val1" | "val2"`.
      I've manually set them to `string | "val1" | "val2"` to avoid
      causing a breaking change in the TypeScript types. We should
      remove these in a future major version of TypeScript.
- [@adobe/jsonschema2md][3]
  The `meta:enum` keyword is used to add documentation for specific enum
  values.

[1]: https://json-schema.org/draft/2019-09/release-notes.html
[2]: https://www.npmjs.com/package/json-schema-to-typescript
[3]: https://www.npmjs.com/package/@adobe/jsonschema2md
Adds a vitepress JsonSchema plugin that automatically loads
the Mermaid Config JSON Schema from a .schema.yaml file and
gets the default values from it.
Automatically build documentation for JSON Schema.

This is only built when running with `--vitepress`,
as it currently produces loads of markdown files, which I feel like
we shouldn't be committing.

This currently manually uses some internal `jsonschema2md` functions
so that we can manually control the Markdown output.
Add script `packages/mermaid/scripts/create-types-from-json-schema.mts`
to automatically generate the TypeScript definition for `MermaidConfig`
from the `MermaidConfig` JSON Schema at
`packages/mermaid/src/schemas/config.schema.yaml`.

To do this, we are using this library
[`json-schema-to-typescript`][1], which is also used by Webpack to
generate their types from their JSON Schema.

In order to make sure that this isn't a breaking change, the script
makes all fields **optional**, as that is what the original typescript
file has.

Additionally, I've put in some custom logic into the script, so that
the exact same order is used for the TypeScript file, to make the
`git diff` easier to review. In the future, we can remove this custom
logic, once we no longer need to worry about `git merge` conflicts.

[1]: https://github.com/bcherny/json-schema-to-typescript
Runs `pnpm --filter mermaid run types:build-config` to automatically
generate typescript types for `MermaidConfig` from the
JSON Schema file.
Adds a temporary test to ensure that the new defaultConfig,
generated by Vite automatically from the `MermaidConfig` JSON Schema,
has the same values as the old defaultConfig
(taken from
https://github.com/mermaid-js/mermaid/blob/38013de7114966e8b1a83396703ef8158bb34466/packages/mermaid/src/defaultConfig.ts)

The only minor difference seems to be that:
  - `gitGraph` now has a default `useMaxWidth: false` option
    (previously used to be `undefined`),
  - `class` now has a `htmlLabels` value of `false` instead of `undefined`.
Add a CI check that runs
`pnpm run --filter mermaid types:verify-config` and checks whether
the MermaidConfig TypeScript types are in sync with the MermaidConfig
JSON Schema.
Fix the link in some Mermaid Config markdown documentation,
which previously pointed to `src/schemas/config.schema.yaml`,
which went nowhere.

Now, these links point to:
  - config.schema.json (i.e. the generated JSON file, not YAML)
  - links are relative to the markdown documentation

We also needed to store the `schema.json` file in the Vitepress
`public/` folder, as Vitepress otherwise doesn't bundle `.json` files
properly, when running `vitepress build src/vitepress`.
@aloisklink aloisklink force-pushed the add-jsonschema-schema-for-config branch from 8542365 to c29088a Compare July 6, 2023 03:31
@aloisklink
Copy link
Member Author

I've git rebase-d onto c742ac7, aka the latest develop branch commit + the 38013de commit from #4602.

git range-diff 9c011abbd424641172b696c038490a36ec99c518..0477a9f68a8d6f474dc792d430ca892d1aa41b66 c742ac71a4f59455ce3dc0b6ac56d5f9b2baa4d2..c29088af019a8180ac2f85d79b890cab4cd5fee5

Changes:

  • Make quadrant chart options TypeScript types optional (from 38013de in PR Make quadrant chart options TypeScript types optional #4602)
  • Change default sankey width (from 9f5f0a6)
  • .vite/jsonSchemaPlugin.ts: Minor refactoring to fix comments from @sidharthv96
  • packages/mermaid/scripts/create-types-from-json-schema.mjs: convert to .mts and fix TypeScript issues .
    Because this file imports some types it creates, type checking for this file will be run with pnpm run --filter mermaid types:verify-config, but not with pnpm run --filter mermaid types:build-config.

I just want to point out something: these changes would work fine with the current approach, but they're most likely to break or change when applying the stuff discussed in #4499, i.g., moving types from config.types.ts into each diagram types files. #4499 (comment)

We could have a separate config.schema.yaml for each diagram, then have a root config.schema.yaml that includes them all, something like:

packages/mermaid/src/
├── schemas/
│   └── config.schema.yaml # imports all the diagrams/*/config.schema.yaml to create the master MermaidConfig
└── diagrams/
    ├── baseDiagram/
    │   └── config.schema.yaml
    ├── my-cool-diagram/
    │   └── config.schema.yaml # imports and extends ../baseDiagram/config.schema.yaml

Honestly, it would be even better to split things up. The current config.schema.yaml is almost 2000 lines of code, so it's a big. And the generated Vitepress page (at http://localhost:3333/config/schema-docs/config.html) is a 1.2 MiB download. The main reason I haven't done it in this PR is to keep things as similar as possible to the existing code.

@aloisklink
Copy link
Member Author

Sorry for accidentally closing this PR (it's my fault, not @sidharthv96!) I wrote Resolves https://github.com/mermaid-js/mermaid/pull/4112#discussion_r1250397326 in PR #4602, so GitHub auto-closed this PR when that one was merged.

@aloisklink aloisklink reopened this Jul 6, 2023
@Yokozuna59
Copy link
Member

We could have a separate config.schema.yaml for each diagram, then have a root config.schema.yaml that includes them all, something like:

packages/mermaid/src/
├── schemas/
│   └── config.schema.yaml # imports all the diagrams/*/config.schema.yaml to create the master MermaidConfig
└── diagrams/
    ├── baseDiagram/
    │   └── config.schema.yaml
    ├── my-cool-diagram/
    │   └── config.schema.yaml # imports and extends ../baseDiagram/config.schema.yaml

Honestly, it would be even better to split things up. The current config.schema.yaml is almost 2000 lines of code, so it's a big. And the generated Vitepress page (at http://localhost:3333/config/schema-docs/config.html) is a 1.2 MiB download. The main reason I haven't done it in this PR is to keep things as similar as possible to the existing code.

Yeah, splitting might be the way to go.
I think we should also add the configuration of each diagram to its own page. If it were me, if I opened the docs, I wouldn't want to open multiple pages to know the syntax, possible themes, and configuration variables. I saw quadrant-chart 's page and really like this approach; the page contains almost everything.

I'm not saying to drop Theming and Config pages; it would help and allow users to see through other possible variables in other diagrams and, of course, to make existing links work :). But I'm a bit weird about the flowchart page; it's already large (my phone hangs when opening the page :) ).


I likes the idea of baseDiagram directory, I think it would help to organize things, like moving base types, i.e.,BaseDiagramConfig.

packages/mermaid/src/docs.mts Show resolved Hide resolved
* develop:
  test: test partial QuadrantChartConfig options
  test: fix types in `config.spec.ts`
  style: fix lint issues in src/config.spec.ts
  test: rename src/config.spec.js to config.spec.ts
  fix lint
  update homepage community link
  docs(flowchart): add documentation on multiple nodes style
  Add docker-specific command, leave commonly used command intact
  Support docs:dev in docker
  Fix lint.
  Update docs
  add ChatGPT plugin blog post
  Fix flowchart tooltip typing
@sidharthv96
Copy link
Member

I love the split config idea. Let's do it in another PR.

@sidharthv96 sidharthv96 added this pull request to the merge queue Jul 6, 2023
Merged via the queue into mermaid-js:develop with commit 2b5da79 Jul 6, 2023
github-merge-queue bot referenced this pull request in fuxingloh/contented Jul 31, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [mermaid](https://togithub.com/mermaid-js/mermaid) | [`10.2.4` ->
`10.3.0`](https://renovatebot.com/diffs/npm/mermaid/10.2.4/10.3.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/mermaid/10.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/mermaid/10.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/mermaid/10.2.4/10.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/mermaid/10.2.4/10.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>mermaid-js/mermaid (mermaid)</summary>

###
[`v10.3.0`](https://togithub.com/mermaid-js/mermaid/releases/tag/v10.3.0):
10.3.0

[Compare
Source](https://togithub.com/mermaid-js/mermaid/compare/v10.2.4...v10.3.0)

#### What's Changed

##### Features

- Sankey diagrams by [@&#8203;nirname](https://togithub.com/nirname) in
[https://github.com/mermaid-js/mermaid/pull/4502](https://togithub.com/mermaid-js/mermaid/pull/4502)
- Feature/1838 actor creation destruction by
[@&#8203;Valentine14th](https://togithub.com/Valentine14th) in
[https://github.com/mermaid-js/mermaid/pull/4466](https://togithub.com/mermaid-js/mermaid/pull/4466)
- Vertical branches in Git Diagram by
[@&#8203;mastersibin](https://togithub.com/mastersibin) in
[https://github.com/mermaid-js/mermaid/pull/4639](https://togithub.com/mermaid-js/mermaid/pull/4639)
- Use JSON Schema to define and document `MermaidConfig` by
[@&#8203;aloisklink](https://togithub.com/aloisklink) in
[https://github.com/mermaid-js/mermaid/pull/4112](https://togithub.com/mermaid-js/mermaid/pull/4112)
- Remove the test checking whether the JSON Schema default config
matched the old default config by
[@&#8203;aloisklink](https://togithub.com/aloisklink) in
[https://github.com/mermaid-js/mermaid/pull/4610](https://togithub.com/mermaid-js/mermaid/pull/4610)
- Fixes support of the macro `ContainerQueue_Ext` for C4 diagrams
definition. by [@&#8203;kislerdm](https://togithub.com/kislerdm) in
[https://github.com/mermaid-js/mermaid/pull/4577](https://togithub.com/mermaid-js/mermaid/pull/4577)

##### Bugfixes

- Make quadrant chart options TypeScript types optional by
[@&#8203;aloisklink](https://togithub.com/aloisklink) in
[https://github.com/mermaid-js/mermaid/pull/4602](https://togithub.com/mermaid-js/mermaid/pull/4602)
- Remove double parsing by
[@&#8203;nirname](https://togithub.com/nirname) in
[https://github.com/mermaid-js/mermaid/pull/4587](https://togithub.com/mermaid-js/mermaid/pull/4587)
- Fix flowchart tooltip typing bug by
[@&#8203;lishid](https://togithub.com/lishid) in
[https://github.com/mermaid-js/mermaid/pull/4562](https://togithub.com/mermaid-js/mermaid/pull/4562)
- Bug/4590 allow notes identical to keywords by
[@&#8203;ibrahimWassouf](https://togithub.com/ibrahimWassouf) in
[https://github.com/mermaid-js/mermaid/pull/4597](https://togithub.com/mermaid-js/mermaid/pull/4597)
- feat: allow specifying on which weekday a tickInterval should start by
[@&#8203;leinelissen](https://togithub.com/leinelissen) in
[https://github.com/mermaid-js/mermaid/pull/4634](https://togithub.com/mermaid-js/mermaid/pull/4634)
- Split formatted markdown strings with unicode support. by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4470](https://togithub.com/mermaid-js/mermaid/pull/4470)
- fix: Mind maps handles `-` signs in node ids/text by
[@&#8203;knsv](https://togithub.com/knsv)

##### Chores

- Remove all TypeScript enums and forbid them in ESLint by
[@&#8203;aloisklink](https://togithub.com/aloisklink) in
[https://github.com/mermaid-js/mermaid/pull/4580](https://togithub.com/mermaid-js/mermaid/pull/4580)
- refactor accessibility by
[@&#8203;Yokozuna59](https://togithub.com/Yokozuna59) in
[https://github.com/mermaid-js/mermaid/pull/4551](https://togithub.com/mermaid-js/mermaid/pull/4551)
- chore: Reduce codecov pushes by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4604](https://togithub.com/mermaid-js/mermaid/pull/4604)
- Run PR-labeler-config-validator only if config changes by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4607](https://togithub.com/mermaid-js/mermaid/pull/4607)
- chore(deps): update all minor dependencies (minor) by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/mermaid-js/mermaid/pull/4624](https://togithub.com/mermaid-js/mermaid/pull/4624)
- Update all patch dependencies (patch) by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/mermaid-js/mermaid/pull/4566](https://togithub.com/mermaid-js/mermaid/pull/4566)
- Update all patch dependencies (patch) by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/mermaid-js/mermaid/pull/4581](https://togithub.com/mermaid-js/mermaid/pull/4581)
- Rename workflow jobs by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4574](https://togithub.com/mermaid-js/mermaid/pull/4574)
- Removed unused code in state diagrams by
[@&#8203;nirname](https://togithub.com/nirname) in
[https://github.com/mermaid-js/mermaid/pull/4631](https://togithub.com/mermaid-js/mermaid/pull/4631)
- chore(deps): update all patch dependencies (patch) by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/mermaid-js/mermaid/pull/4623](https://togithub.com/mermaid-js/mermaid/pull/4623)
- chore: remove unused `devDependency` on coveralls by
[@&#8203;aloisklink](https://togithub.com/aloisklink) in
[https://github.com/mermaid-js/mermaid/pull/4641](https://togithub.com/mermaid-js/mermaid/pull/4641)
- Allow entity diagram attribute names to start with asterisk by
[@&#8203;ibrahimWassouf](https://togithub.com/ibrahimWassouf) in
[https://github.com/mermaid-js/mermaid/pull/4588](https://togithub.com/mermaid-js/mermaid/pull/4588)
- Bug/4592 fix new line padding class diagram by
[@&#8203;ibrahimWassouf](https://togithub.com/ibrahimWassouf) in
[https://github.com/mermaid-js/mermaid/pull/4633](https://togithub.com/mermaid-js/mermaid/pull/4633)
- Fix graph not loading when the img loads too fast or fail to load by
[@&#8203;pierrickouw](https://togithub.com/pierrickouw) in
[https://github.com/mermaid-js/mermaid/pull/4496](https://togithub.com/mermaid-js/mermaid/pull/4496)
- convert `cypress/helpers/util.js` to ts by
[@&#8203;Yokozuna59](https://togithub.com/Yokozuna59) in
[https://github.com/mermaid-js/mermaid/pull/4552](https://togithub.com/mermaid-js/mermaid/pull/4552)
- build(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/mermaid-js/mermaid/pull/4652](https://togithub.com/mermaid-js/mermaid/pull/4652)
- chore(deps): update all minor dependencies (minor) by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/mermaid-js/mermaid/pull/4663](https://togithub.com/mermaid-js/mermaid/pull/4663)
- chore(deps): update all patch dependencies (patch) by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/mermaid-js/mermaid/pull/4662](https://togithub.com/mermaid-js/mermaid/pull/4662)

##### Documentation

- Sankey: Remove duplicated examples by
[@&#8203;nirname](https://togithub.com/nirname) in
[https://github.com/mermaid-js/mermaid/pull/4595](https://togithub.com/mermaid-js/mermaid/pull/4595)
- Release docs by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4493](https://togithub.com/mermaid-js/mermaid/pull/4493)
- Update latest news section by
[@&#8203;huynhicode](https://togithub.com/huynhicode) in
[https://github.com/mermaid-js/mermaid/pull/4495](https://togithub.com/mermaid-js/mermaid/pull/4495)
- Fix Typo by [@&#8203;ryru](https://togithub.com/ryru) in
[https://github.com/mermaid-js/mermaid/pull/4567](https://togithub.com/mermaid-js/mermaid/pull/4567)
- Docs: add ChatGPT plugin blog post by
[@&#8203;huynhicode](https://togithub.com/huynhicode) in
[https://github.com/mermaid-js/mermaid/pull/4570](https://togithub.com/mermaid-js/mermaid/pull/4570)
- Fix relative link to theme variables list by
[@&#8203;ibrahimWassouf](https://togithub.com/ibrahimWassouf) in
[https://github.com/mermaid-js/mermaid/pull/4573](https://togithub.com/mermaid-js/mermaid/pull/4573)
- Fix docs:dev by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4598](https://togithub.com/mermaid-js/mermaid/pull/4598)
- Docs: update link - "Join the Community" by
[@&#8203;huynhicode](https://togithub.com/huynhicode) in
[https://github.com/mermaid-js/mermaid/pull/4601](https://togithub.com/mermaid-js/mermaid/pull/4601)
- Support docs:dev in docker by
[@&#8203;nirname](https://togithub.com/nirname) in
[https://github.com/mermaid-js/mermaid/pull/4599](https://togithub.com/mermaid-js/mermaid/pull/4599)
- docs(flowchart): add documentation on multiple nodes style by
[@&#8203;tomperr](https://togithub.com/tomperr) in
[https://github.com/mermaid-js/mermaid/pull/4600](https://togithub.com/mermaid-js/mermaid/pull/4600)
- Avoid downloading avtars everytime on docs:dev by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4603](https://togithub.com/mermaid-js/mermaid/pull/4603)
- docs: Fix checkbox syntax by
[@&#8203;guilhermgonzaga](https://togithub.com/guilhermgonzaga) in
[https://github.com/mermaid-js/mermaid/pull/4646](https://togithub.com/mermaid-js/mermaid/pull/4646)
- Fix the "Edit this page on GitHub" link in Vitepress documentation for
the Mermaid Config pages by
[@&#8203;aloisklink](https://togithub.com/aloisklink) in
[https://github.com/mermaid-js/mermaid/pull/4640](https://togithub.com/mermaid-js/mermaid/pull/4640)
- Support MERMAID_RELEASE_VERSION in docs. by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4612](https://togithub.com/mermaid-js/mermaid/pull/4612)
- Docs: update Latest News section by
[@&#8203;huynhicode](https://togithub.com/huynhicode) in
[https://github.com/mermaid-js/mermaid/pull/4655](https://togithub.com/mermaid-js/mermaid/pull/4655)
- added Typora to integrations list by
[@&#8203;kgilbert78](https://togithub.com/kgilbert78) in
[https://github.com/mermaid-js/mermaid/pull/4666](https://togithub.com/mermaid-js/mermaid/pull/4666)
- Docs: Corrects name of C4 link by
[@&#8203;Incognito](https://togithub.com/Incognito) in
[https://github.com/mermaid-js/mermaid/pull/4660](https://togithub.com/mermaid-js/mermaid/pull/4660)
- Fix a typo by [@&#8203;gjtorikian](https://togithub.com/gjtorikian) in
[https://github.com/mermaid-js/mermaid/pull/4396](https://togithub.com/mermaid-js/mermaid/pull/4396)

#### New Contributors

- [@&#8203;ryru](https://togithub.com/ryru) made their first
contribution in
[https://github.com/mermaid-js/mermaid/pull/4567](https://togithub.com/mermaid-js/mermaid/pull/4567)
- [@&#8203;ibrahimWassouf](https://togithub.com/ibrahimWassouf) made
their first contribution in
[https://github.com/mermaid-js/mermaid/pull/4573](https://togithub.com/mermaid-js/mermaid/pull/4573)
- [@&#8203;kislerdm](https://togithub.com/kislerdm) made their first
contribution in
[https://github.com/mermaid-js/mermaid/pull/4577](https://togithub.com/mermaid-js/mermaid/pull/4577)
- [@&#8203;leinelissen](https://togithub.com/leinelissen) made their
first contribution in
[https://github.com/mermaid-js/mermaid/pull/4634](https://togithub.com/mermaid-js/mermaid/pull/4634)
- [@&#8203;pierrickouw](https://togithub.com/pierrickouw) made their
first contribution in
[https://github.com/mermaid-js/mermaid/pull/4496](https://togithub.com/mermaid-js/mermaid/pull/4496)
- [@&#8203;mastersibin](https://togithub.com/mastersibin) made their
first contribution in
[https://github.com/mermaid-js/mermaid/pull/4639](https://togithub.com/mermaid-js/mermaid/pull/4639)
- [@&#8203;kgilbert78](https://togithub.com/kgilbert78) made their first
contribution in
[https://github.com/mermaid-js/mermaid/pull/4666](https://togithub.com/mermaid-js/mermaid/pull/4666)
- [@&#8203;Incognito](https://togithub.com/Incognito) made their first
contribution in
[https://github.com/mermaid-js/mermaid/pull/4660](https://togithub.com/mermaid-js/mermaid/pull/4660)
- [@&#8203;gjtorikian](https://togithub.com/gjtorikian) made their first
contribution in
[https://github.com/mermaid-js/mermaid/pull/4396](https://togithub.com/mermaid-js/mermaid/pull/4396)

**Full Changelog**:
mermaid-js/mermaid@v10.2.4...v10.3.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/levaintech/contented).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@aloisklink aloisklink deleted the add-jsonschema-schema-for-config branch August 10, 2023 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants