Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eight-crabs-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'mermaid': patch
---

fix: Support the [`htmlLabels` Mermaid config value](https://mermaid.js.org/config/schema-docs/config.html#htmllabels) whenever possible
5 changes: 5 additions & 0 deletions .changeset/seven-towns-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'mermaid': minor
---

feat: Deprecate [`flowchart.htmlLabels`](https://mermaid.js.org/config/schema-docs/config-defs-flowchart-diagram-config.html#htmllabels) in favor of [root-level `htmlLabels`](https://mermaid.js.org/config/schema-docs/config.html#htmllabels) in Mermaid config
11 changes: 8 additions & 3 deletions docs/config/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ The following code snippet shows the structure of a directive:
"theme": "dark",
"fontFamily": "monospace",
"logLevel": "info",
"htmlLabels": true,
"flowchart": {
"htmlLabels": true,
"curve": "linear"
},
"sequence": {
Expand Down Expand Up @@ -236,7 +236,7 @@ A --> C[End]

Some common flowchart configurations are:

- _htmlLabels_: true/false
- ~~_htmlLabels_~~: Deprecated, [prefer setting this at the root level](/config/schema-docs/config#htmllabels).
- _curve_: linear/curve
- _diagramPadding_: number
- _useMaxWidth_: number
Expand All @@ -246,10 +246,15 @@ _Soon we plan to publish a complete list of all diagram-specific configurations

The following code snippet changes flowchart config:

`%%{init: { "flowchart": { "htmlLabels": true, "curve": "linear" } } }%%`
```
%%{init: { "htmlLabels": true, "flowchart": { "curve": "linear" } } }%%
```

Here we are overriding only the flowchart config, and not the general config, setting `htmlLabels` to `true` and `curve` to `linear`.

> **Warning**
> **Deprecated:** `flowchart.htmlLabels` has been deprecated from (v\<MERMAID_RELEASE_VERSION>+). Use the global `htmlLabels` configuration instead. For example, instead of `"flowchart": { "htmlLabels": true }`, use `"htmlLabels": true` at the top level.

```mermaid-example
%%{init: { "flowchart": { "htmlLabels": true, "curve": "linear" } } }%%
graph TD
Expand Down
2 changes: 2 additions & 0 deletions docs/config/setup/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
## Functions

- [addDirective](functions/addDirective.md)
- [evaluate](functions/evaluate.md)
- [getConfig](functions/getConfig.md)
- [getEffectiveHtmlLabels](functions/getEffectiveHtmlLabels.md)
- [getSiteConfig](functions/getSiteConfig.md)
- [getUserDefinedConfig](functions/getUserDefinedConfig.md)
- [reset](functions/reset.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/config/setup/config/functions/addDirective.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **addDirective**(`directive`): `void`

Defined in: [packages/mermaid/src/config.ts:188](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L188)
Defined in: [packages/mermaid/src/config.ts:197](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L197)

Pushes in a directive to the configuration

Expand Down
31 changes: 31 additions & 0 deletions docs/config/setup/config/functions/evaluate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/evaluate.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/evaluate.md).

[**mermaid**](../../README.md)

---

# Function: evaluate()

> **evaluate**(`val?`): `boolean`

Defined in: [packages/mermaid/src/config.ts:16](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L16)

Converts a string/boolean into a boolean

## Parameters

### val?

String or boolean to convert

`string` | `boolean`

## Returns

`boolean`

The result from the input
2 changes: 1 addition & 1 deletion docs/config/setup/config/functions/getConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **getConfig**(): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)

Defined in: [packages/mermaid/src/config.ts:131](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L131)
Defined in: [packages/mermaid/src/config.ts:140](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L140)

## getConfig

Expand Down
31 changes: 31 additions & 0 deletions docs/config/setup/config/functions/getEffectiveHtmlLabels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/getEffectiveHtmlLabels.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/getEffectiveHtmlLabels.md).

[**mermaid**](../../README.md)

---

# Function: getEffectiveHtmlLabels()

> **getEffectiveHtmlLabels**(`config`): `boolean`

Defined in: [packages/mermaid/src/config.ts:282](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L282)

Helper function to handle deprecated flowchart.htmlLabels

## Parameters

### config

[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)

The configuration object (merged config with defaults)

## Returns

`boolean`

The effective htmlLabels value based on precedence: root flowchart default
2 changes: 1 addition & 1 deletion docs/config/setup/config/functions/getSiteConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **getSiteConfig**(): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)

Defined in: [packages/mermaid/src/config.ts:96](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L96)
Defined in: [packages/mermaid/src/config.ts:105](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L105)

## getSiteConfig

Expand Down
2 changes: 1 addition & 1 deletion docs/config/setup/config/functions/getUserDefinedConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **getUserDefinedConfig**(): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)

Defined in: [packages/mermaid/src/config.ts:252](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L252)
Defined in: [packages/mermaid/src/config.ts:263](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L263)

## Returns

Expand Down
2 changes: 1 addition & 1 deletion docs/config/setup/config/functions/reset.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **reset**(`config`): `void`

Defined in: [packages/mermaid/src/config.ts:221](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L221)
Defined in: [packages/mermaid/src/config.ts:230](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L230)

## reset

Expand Down
2 changes: 1 addition & 1 deletion docs/config/setup/config/functions/sanitize.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **sanitize**(`options`): `void`

Defined in: [packages/mermaid/src/config.ts:146](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L146)
Defined in: [packages/mermaid/src/config.ts:155](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L155)

## sanitize

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **saveConfigFromInitialize**(`conf`): `void`

Defined in: [packages/mermaid/src/config.ts:75](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L75)
Defined in: [packages/mermaid/src/config.ts:84](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L84)

## Parameters

Expand Down
2 changes: 1 addition & 1 deletion docs/config/setup/config/functions/setConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **setConfig**(`conf`): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)

Defined in: [packages/mermaid/src/config.ts:113](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L113)
Defined in: [packages/mermaid/src/config.ts:122](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L122)

## setConfig

Expand Down
2 changes: 1 addition & 1 deletion docs/config/setup/config/functions/setSiteConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **setSiteConfig**(`conf`): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)

Defined in: [packages/mermaid/src/config.ts:61](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L61)
Defined in: [packages/mermaid/src/config.ts:70](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L70)

## setSiteConfig

Expand Down
2 changes: 1 addition & 1 deletion docs/config/setup/config/functions/updateCurrentConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **updateCurrentConfig**(`siteCfg`, `_directives`): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)

Defined in: [packages/mermaid/src/config.ts:15](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L15)
Defined in: [packages/mermaid/src/config.ts:24](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L24)

## Parameters

Expand Down
2 changes: 1 addition & 1 deletion docs/config/setup/config/functions/updateSiteConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **updateSiteConfig**(`conf`): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)

Defined in: [packages/mermaid/src/config.ts:79](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L79)
Defined in: [packages/mermaid/src/config.ts:88](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L88)

## Parameters

Expand Down
Loading
Loading