You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5645620
Browse filesBrowse the repository at this point in the historyBrowse files
Mermaid diagrams rendered as png or svg images are sized at their
natural size at 96 dpi, so their 16px text prints at 12pt and wide
diagrams can run past the page. fig-width scales each diagram by a
different factor, which gives every diagram a different text size.
mermaid-scale takes a percentage, such as 75%, and multiplies the
natural width and height by it, so all diagrams keep the same text
size. It can be set in the document front matter or on a single
cell, where it overrides the document value. An explicit fig-width
or fig-height still takes precedence. With mermaid-format: js the
browser sizes the diagram, so the option has no effect there.
Both the cell and front matter schemas validate the value, so a bare
number or other string fails with a clear error instead of a crash.
Copy file name to clipboardExpand all lines: news/changelog-1.11.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,7 @@ All changes included in 1.11:
52
52
- ([#14772](https://github.com/quarto-dev/quarto-cli/issues/14772)): Custom `language` keys now reach templates through `$quarto.language.<key>$`. A key that Quarto does not ship passed schema validation and was merged over the defaults, then discarded before templates saw it, so it expanded to an empty string with no warning. (author: @mcanouil)
53
53
- ([#14882](https://github.com/quarto-dev/quarto-cli/issues/14882)): Fix brand font families with a word starting with a digit, such as `Source Sans 3`, not applying in `html` and `revealjs` output. The same names in `mainfont` now also apply in `revealjs`. (author: @Masad791)
54
54
- ([#14891](https://github.com/quarto-dev/quarto-cli/issues/14891)): Fix a brand file that holds only comments, such as a commented-out `_brand.yml` template, stopping the render with `YAML value is missing`. It now prints a warning and is ignored. (author: @Masad791)
55
+
- ([#NNNNN](https://github.com/quarto-dev/quarto-cli/pull/NNNNN)): Add a `mermaid-scale` option, such as `mermaid-scale: 75%`, that resizes Mermaid diagrams rendered as `png` or `svg` images by a percentage of their natural size, at the document or cell level. An explicit `fig-width` or `fig-height` still takes precedence. (author: @faysou)
Copy file name to clipboardExpand all lines: src/resources/editor/tools/vs-code.mjs
+27-5Lines changed: 27 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -17492,6 +17492,18 @@ var require_yaml_intelligence_resources = __commonJS({
17492
17492
}
17493
17493
},
17494
17494
description: "Mermaid diagram options"
17495
+
},
17496
+
{
17497
+
name: "mermaid-scale",
17498
+
schema: {
17499
+
string: {
17500
+
pattern: "^[0-9]+(\\.[0-9]+)?%$"
17501
+
}
17502
+
},
17503
+
description: {
17504
+
short: "Scale for Mermaid diagrams rendered as images",
17505
+
long: "Percentage of their natural size at which Mermaid diagrams rendered\nwith `mermaid-format: png` or `svg` are shown, for example `75%`.\nAn explicit `fig-width` or `fig-height` takes precedence.\n"
17506
+
}
17495
17507
}
17496
17508
],
17497
17509
"schema/document-metadata.yml": [
@@ -24397,6 +24409,10 @@ var require_yaml_intelligence_resources = __commonJS({
24397
24409
"Automatically generate the contents of a page from a list of Quarto\ndocuments or other custom data.",
24398
24410
"Mermaid diagram options",
24399
24411
"The mermaid built-in theme to use.",
24412
+
{
24413
+
short: "Scale for Mermaid diagrams rendered as images",
24414
+
long: "Percentage of their natural size at which Mermaid diagrams rendered\nwith <code>mermaid-format: png</code> or <code>svg</code> are shown, for\nexample <code>75%</code>. An explicit <code>fig-width</code> or\n<code>fig-height</code> takes precedence."
24415
+
},
24400
24416
"List of keywords to be included in the document metadata.",
24401
24417
"The document subject",
24402
24418
"The subject text.",
@@ -25827,12 +25843,12 @@ var require_yaml_intelligence_resources = __commonJS({
25827
25843
mermaid: "%%"
25828
25844
},
25829
25845
"handlers/mermaid/schema.yml": {
25830
-
_internalId: 221295,
25846
+
_internalId: 221618,
25831
25847
type: "object",
25832
25848
description: "be an object",
25833
25849
properties: {
25834
25850
"mermaid-format": {
25835
-
_internalId: 221287,
25851
+
_internalId: 221607,
25836
25852
type: "enum",
25837
25853
enum: [
25838
25854
"png",
@@ -25847,8 +25863,14 @@ var require_yaml_intelligence_resources = __commonJS({
25847
25863
],
25848
25864
exhaustiveCompletions: true
25849
25865
},
25866
+
"mermaid-scale": {
25867
+
_internalId: 221610,
25868
+
type: "string",
25869
+
pattern: "^[0-9]+(\\.[0-9]+)?%$",
25870
+
description: 'be a string that satisfies regex "^[0-9]+(\\.[0-9]+)?%$"'
25871
+
},
25850
25872
theme: {
25851
-
_internalId: 221294,
25873
+
_internalId: 221617,
25852
25874
type: "anyOf",
25853
25875
anyOf: [
25854
25876
{
@@ -25869,9 +25891,9 @@ var require_yaml_intelligence_resources = __commonJS({
25869
25891
},
25870
25892
patternProperties: {},
25871
25893
propertyNames: {
25872
-
errorMessage: "property ${value} does not match case convention mermaid-format,theme",
25894
+
errorMessage: "property ${value} does not match case convention mermaid-format,mermaid-scale,theme",
Copy file name to clipboardExpand all lines: src/resources/editor/tools/yaml/yaml-intelligence-resources.json
+27-5Lines changed: 27 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -10460,6 +10460,18 @@
10460
10460
}
10461
10461
},
10462
10462
"description": "Mermaid diagram options"
10463
+
},
10464
+
{
10465
+
"name": "mermaid-scale",
10466
+
"schema": {
10467
+
"string": {
10468
+
"pattern": "^[0-9]+(\\.[0-9]+)?%$"
10469
+
}
10470
+
},
10471
+
"description": {
10472
+
"short": "Scale for Mermaid diagrams rendered as images",
10473
+
"long": "Percentage of their natural size at which Mermaid diagrams rendered\nwith `mermaid-format: png` or `svg` are shown, for example `75%`.\nAn explicit `fig-width` or `fig-height` takes precedence.\n"
10474
+
}
10463
10475
}
10464
10476
],
10465
10477
"schema/document-metadata.yml": [
@@ -17365,6 +17377,10 @@
17365
17377
"Automatically generate the contents of a page from a list of Quarto\ndocuments or other custom data.",
17366
17378
"Mermaid diagram options",
17367
17379
"The mermaid built-in theme to use.",
17380
+
{
17381
+
"short": "Scale for Mermaid diagrams rendered as images",
17382
+
"long": "Percentage of their natural size at which Mermaid diagrams rendered\nwith <code>mermaid-format: png</code> or <code>svg</code> are shown, for\nexample <code>75%</code>. An explicit <code>fig-width</code> or\n<code>fig-height</code> takes precedence."
17383
+
},
17368
17384
"List of keywords to be included in the document metadata.",
17369
17385
"The document subject",
17370
17386
"The subject text.",
@@ -18795,12 +18811,12 @@
18795
18811
"mermaid": "%%"
18796
18812
},
18797
18813
"handlers/mermaid/schema.yml": {
18798
-
"_internalId": 221295,
18814
+
"_internalId": 221618,
18799
18815
"type": "object",
18800
18816
"description": "be an object",
18801
18817
"properties": {
18802
18818
"mermaid-format": {
18803
-
"_internalId": 221287,
18819
+
"_internalId": 221607,
18804
18820
"type": "enum",
18805
18821
"enum": [
18806
18822
"png",
@@ -18815,8 +18831,14 @@
18815
18831
],
18816
18832
"exhaustiveCompletions": true
18817
18833
},
18834
+
"mermaid-scale": {
18835
+
"_internalId": 221610,
18836
+
"type": "string",
18837
+
"pattern": "^[0-9]+(\\.[0-9]+)?%$",
18838
+
"description": "be a string that satisfies regex \"^[0-9]+(\\.[0-9]+)?%$\""
18839
+
},
18818
18840
"theme": {
18819
-
"_internalId": 221294,
18841
+
"_internalId": 221617,
18820
18842
"type": "anyOf",
18821
18843
"anyOf": [
18822
18844
{
@@ -18837,9 +18859,9 @@
18837
18859
},
18838
18860
"patternProperties": {},
18839
18861
"propertyNames": {
18840
-
"errorMessage": "property ${value} does not match case convention mermaid-format,theme",
18862
+
"errorMessage": "property ${value} does not match case convention mermaid-format,mermaid-scale,theme",
0 commit comments