Skip to content

Commit 35c868a

Browse files
committed
Merge branch 'main' of github.com:quarto-dev/quarto-cli into main
2 parents 793eb77 + 99ba3e5 commit 35c868a

File tree

9 files changed

+228
-67
lines changed

9 files changed

+228
-67
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: "Bug report"
3+
about: Report an error or unexpected behavior you saw while using this package
4+
title: ""
5+
labels: ""
6+
assignees: ""
7+
---
8+
9+
<!--
10+
Welcome to the quarto GitHub repo!
11+
12+
We are always happy to hear feedback from our users.
13+
14+
To file a _bug report_, please follow these instructions carefully: <https://yihui.org/issue/#bug-reports>
15+
16+
Also, please complete and keep the checklist below in your issue. This helps you know what to check for opening a good issue report. It also helps know that you've have done the common steps that can solve your potential issue.
17+
18+
At last, if you have posted the same issue elsewhere, please mention it here, with a link to the other issue.
19+
20+
-->
21+
22+
## Checklist
23+
24+
When filing a _bug report_, please check the boxes below to confirm that you have provided us with the information we need. Have you:
25+
26+
- [ ] [formatted your issue](https://yihui.org/issue/#please-format-your-issue-correctly) so it is easier for us to read?
27+
28+
- [ ] included a minimal, self-contained, and reproducible example?
29+
30+
- [ ] documented the quarto version you're running, by pasting the first line produced by `quarto render` in a terminal in your issue? ("This is quarto ...")
31+
32+
- [ ] upgraded to the latest version (including your versions of R, the RStudio IDE, and relevant R packages)?

.github/workflows/create-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ jobs:
210210
path: ./package/out/quarto-${{needs.configure.outputs.version}}-macos.tar.gz
211211

212212
- name: Cleanup Keychain
213+
if: ${{ always() }}
213214
run: |
214215
security delete-keychain build.keychain
215216

src/command/preview/cmd.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import {
3939
import { isHtmlOutput } from "../../config/format.ts";
4040
import { renderProject } from "../render/project.ts";
4141
import { renderServices } from "../render/render-shared.ts";
42-
4342
export const previewCommand = new Command()
4443
.name("preview")
4544
.stopEarly()

src/config/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,3 +577,5 @@ export const kLayoutVAlign = "layout-valign";
577577
export const kLayoutNcol = "layout-ncol";
578578
export const kLayoutNrow = "layout-nrow";
579579
export const kLayout = "layout";
580+
581+
export const kMermaidDev = "mermaid-dev";

src/core/handlers/mermaid.ts

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,24 @@ import {
3131
kFigHeight,
3232
kFigResponsive,
3333
kFigWidth,
34+
kMermaidDev,
3435
} from "../../config/constants.ts";
3536
import { Element } from "../deno-dom.ts";
37+
import { convertFromYaml } from "../lib/yaml-schema/from-yaml.ts";
38+
import { readYamlFromString } from "../yaml.ts";
3639

3740
const mermaidHandler: LanguageHandler = {
3841
...baseHandler,
3942

43+
schema() {
44+
return Promise.resolve(convertFromYaml(readYamlFromString(`
45+
object:
46+
properties:
47+
mermaid-dev:
48+
enum: [png, svg]
49+
`)));
50+
},
51+
4052
type: "cell",
4153
stage: "post-engine",
4254

@@ -82,7 +94,7 @@ const mermaidHandler: LanguageHandler = {
8294
),
8395
]];
8496

85-
if (isJavascriptCompatible(handlerContext.options.format)) {
97+
const makeSvg = async () => {
8698
let svg = asMappedString(
8799
(await handlerContext.extractHtml({
88100
html: content,
@@ -135,7 +147,9 @@ const mermaidHandler: LanguageHandler = {
135147
undefined,
136148
new Set(["fig-width", "fig-height"]),
137149
);
138-
} else {
150+
};
151+
152+
const makePng = async () => {
139153
const {
140154
filenames: [sourceName],
141155
elements: [svgText],
@@ -163,6 +177,29 @@ const mermaidHandler: LanguageHandler = {
163177
undefined,
164178
new Set(["fig-width", "fig-height"]),
165179
);
180+
};
181+
182+
if (isJavascriptCompatible(handlerContext.options.format)) {
183+
return await makeSvg();
184+
} else if (
185+
isMarkdownOutput(handlerContext.options.format.pandoc, ["gfm"])
186+
) {
187+
if (options[kMermaidDev] === "svg") {
188+
return await makeSvg();
189+
} else if (options[kMermaidDev] === "png") {
190+
return await makePng();
191+
} else {
192+
return this.build(
193+
handlerContext,
194+
cell,
195+
mappedConcat(["\n``` mermaid\n", cellContent, "\n```\n"]),
196+
options,
197+
undefined,
198+
new Set(["fig-width", "fig-height"]),
199+
);
200+
}
201+
} else {
202+
return await makePng();
166203
}
167204
},
168205
};

src/resources/editor/tools/vs-code.mjs

Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10522,7 +10522,7 @@ var require_yaml_intelligence_resources = __commonJS({
1052210522
"treaty",
1052310523
"webpage"
1052410524
],
10525-
description: "The type of the item."
10525+
description: "The [type](https://docs.citationstyles.org/en/stable/specification.html#appendix-iii-types) of the item."
1052610526
},
1052710527
url: {
1052810528
string: {
@@ -13272,7 +13272,7 @@ var require_yaml_intelligence_resources = __commonJS({
1327213272
default: false,
1327313273
description: {
1327413274
short: "Whether to use document class settings for indentation.",
13275-
long: "Wheher to use document class settings for indentation. If the document \nclass settings are not used, the default LaTeX template removes indentation \nand adds space between paragraphs\n\nFor groff (`ms`) documents, the paragraph indent, for example, `2m`.\n"
13275+
long: "Whether to use document class settings for indentation. If the document \nclass settings are not used, the default LaTeX template removes indentation \nand adds space between paragraphs\n\nFor groff (`ms`) documents, the paragraph indent, for example, `2m`.\n"
1327613276
}
1327713277
},
1327813278
{
@@ -13619,6 +13619,18 @@ var require_yaml_intelligence_resources = __commonJS({
1361913619
}
1362013620
}
1362113621
],
13622+
"schema/document-ojs.yml": [
13623+
{
13624+
name: "ojs-engine",
13625+
tags: {
13626+
formats: [
13627+
"$html-files"
13628+
]
13629+
},
13630+
schema: "boolean",
13631+
description: "If `true`, force the presence of the OJS runtime. If `false`, force the absence instead.\nIf unset, the OJS runtime is included only if OJS cells are present in the document.\n"
13632+
}
13633+
],
1362213634
"schema/document-options.yml": [
1362313635
{
1362413636
name: "reference-doc",
@@ -16912,7 +16924,7 @@ var require_yaml_intelligence_resources = __commonJS({
1691216924
"Base URL for published website",
1691316925
"Path to site (defaults to \u2018/\u2019). Not required if you specify\n<code>site-url</code>.",
1691416926
"Base URL for website source code repository",
16915-
"Subdirectory of repository containing website or book",
16927+
"Subdirectory of repository containing website",
1691616928
"Branch of website source code (defaults to <code>main</code>)",
1691716929
{
1691816930
short: "Links to source repository actions",
@@ -17083,7 +17095,7 @@ var require_yaml_intelligence_resources = __commonJS({
1708317095
"The text describing the creator or contributor (for example, creator\nname).",
1708417096
{
1708517097
short: "The role of this creator or contributor.",
17086-
long: 'The role of this creator or contributor using <a href="https://loc.gov/marc/relators/relaterm.html">MARC relators</a>.\nHuman readable translations to commonly used relators (e.g.&nbsp;\u2018author\u2019,\n\u2018editor\u2019) will attempt to be automatically translated.'
17098+
long: 'The role of this creator or contributor using <a href="https://loc.gov/marc/relators/relaterm.html">MARC relators</a>.\nHuman readable translations to commonly used relators (e.g.&nbsp;\uFFFD\uFFFD\uFFFDauthor\u2019,\n\u2018editor\u2019) will attempt to be automatically translated.'
1708717099
},
1708817100
"An alternate version of the creator or contributor text used for\nalphabatizing.",
1708917101
"The text describing the creator or contributor (for example, creator\nname).",
@@ -17360,7 +17372,7 @@ var require_yaml_intelligence_resources = __commonJS({
1736017372
"The primary title of the item.",
1736117373
"Short/abbreviated form of<code>title</code>.",
1736217374
"Translator",
17363-
"The type of the item.",
17375+
'The <a href="https://docs.citationstyles.org/en/stable/specification.html#appendix-iii-types">type</a>\nof the item.',
1736417376
"Uniform Resource Locator\n(e.g.&nbsp;\u201Chttps://aem.asm.org/cgi/content/full/74/9/2766\u201D)",
1736517377
"Version of the item (e.g.&nbsp;\u201C2.0.9\u201D for a software program).",
1736617378
{
@@ -17996,7 +18008,7 @@ var require_yaml_intelligence_resources = __commonJS({
1799618008
},
1799718009
{
1799818010
short: "Whether to use document class settings for indentation.",
17999-
long: "Wheher to use document class settings for indentation. If the\ndocument class settings are not used, the default LaTeX template removes\nindentation and adds space between paragraphs\nFor groff (<code>ms</code>) documents, the paragraph indent, for\nexample, <code>2m</code>."
18011+
long: "Whether to use document class settings for indentation. If the\ndocument class settings are not used, the default LaTeX template removes\nindentation and adds space between paragraphs\nFor groff (<code>ms</code>) documents, the paragraph indent, for\nexample, <code>2m</code>."
1800018012
},
1800118013
{
1800218014
short: "Make <code>\\paragraph</code> and <code>\\subparagraph</code>\nfree-standing rather than run-in.",
@@ -18052,6 +18064,7 @@ var require_yaml_intelligence_resources = __commonJS({
1805218064
short: "Treat top-level headings as the given division type\n(<code>default</code>, <code>section</code>, <code>chapter</code>, or\n<code>part</code>). The hierarchy order is part, chapter, then section;\nall headings are shifted such that the top-level heading becomes the\nspecified type.",
1805318065
long: "Treat top-level headings as the given division type\n(<code>default</code>, <code>section</code>, <code>chapter</code>, or\n<code>part</code>). The hierarchy order is part, chapter, then section;\nall headings are shifted such that the top-level heading becomes the\nspecified type.\nThe default behavior is to determine the best division type via\nheuristics: unless other conditions apply, <code>section</code> is\nchosen. When the <code>documentclass</code> variable is set to\n<code>report</code>, <code>book</code>, or <code>memoir</code> (unless\nthe <code>article</code> option is specified), <code>chapter</code> is\nimplied as the setting for this option. If <code>beamer</code> is the\noutput format, specifying either <code>chapter</code> or\n<code>part</code> will cause top-level headings to become\n<code>\\part{..}</code>, while second-level headings remain as their\ndefault type."
1805418066
},
18067+
"If <code>true</code>, force the presence of the OJS runtime. If\n<code>false</code>, force the absence instead. If unset, the OJS runtime\nis included only if OJS cells are present in the document.",
1805518068
"Use the specified file as a style reference in producing a docx,\npptx, or odt file.",
1805618069
"Theme name, theme scss file, or a mix of both.",
1805718070
"The light theme name, theme scss file, or a mix of both.",
@@ -18396,7 +18409,7 @@ var require_yaml_intelligence_resources = __commonJS({
1839618409
"Base URL for published website",
1839718410
"Path to site (defaults to \u2018/\u2019). Not required if you specify\n<code>site-url</code>.",
1839818411
"Base URL for website source code repository",
18399-
"Subdirectory of repository containing website or book",
18412+
"Subdirectory of repository containing website",
1840018413
"Branch of website source code (defaults to <code>main</code>)",
1840118414
{
1840218415
short: "Links to source repository actions",
@@ -18575,7 +18588,6 @@ var require_yaml_intelligence_resources = __commonJS({
1857518588
"Download buttons for other formats to include on navbar or sidebar\n(one or more of <code>pdf</code>, <code>epub</code>, and `docx)",
1857618589
"Custom tools for navbar or sidebar",
1857718590
"internal-schema-hack",
18578-
"If <code>true</code>, force the presence of the OJS runtime. If\n<code>false</code>, force the absence instead. If unset, the OJS runtime\nis included only if OJS cells are present in the document.",
1857918591
"MISSING_DESCRIPTION",
1858018592
"Project type (<code>default</code>, <code>website</code>, or\n<code>book</code>)",
1858118593
"Files to render (defaults to all files)",
@@ -18596,7 +18608,7 @@ var require_yaml_intelligence_resources = __commonJS({
1859618608
"Base URL for published website",
1859718609
"Path to site (defaults to \u2018/\u2019). Not required if you specify\n<code>site-url</code>.",
1859818610
"Base URL for website source code repository",
18599-
"Subdirectory of repository containing website or book",
18611+
"Subdirectory of repository containing website",
1860018612
"Branch of website source code (defaults to <code>main</code>)",
1860118613
{
1860218614
short: "Links to source repository actions",
@@ -18976,18 +18988,36 @@ var require_yaml_intelligence_resources = __commonJS({
1897618988
ojs: "//",
1897718989
mermaid: "%%"
1897818990
},
18979-
"schema/document-ojs.yml": [
18980-
{
18981-
name: "ojs-engine",
18982-
tags: {
18983-
formats: [
18984-
"$html-files"
18985-
]
18986-
},
18987-
schema: "boolean",
18988-
description: "If `true`, force the presence of the OJS runtime. If `false`, force the absence instead.\nIf unset, the OJS runtime is included only if OJS cells are present in the document.\n"
18989-
}
18990-
]
18991+
"handlers/mermaid/schema.yml": {
18992+
type: "object",
18993+
description: "be an object",
18994+
properties: {
18995+
"mermaid-dev": {
18996+
type: "enum",
18997+
enum: [
18998+
"png",
18999+
"svg"
19000+
],
19001+
description: "be one of: `png`, `svg`",
19002+
completions: [
19003+
"png",
19004+
"svg"
19005+
],
19006+
exhaustiveCompletions: true
19007+
}
19008+
},
19009+
patternProperties: {},
19010+
propertyNames: {
19011+
type: "string",
19012+
pattern: "^(?!(mermaid_dev|mermaidDev))"
19013+
},
19014+
tags: {
19015+
"case-convention": [
19016+
"dash-case"
19017+
]
19018+
},
19019+
$id: "handlers/mermaid"
19020+
}
1899119021
};
1899219022
}
1899319023
});

0 commit comments

Comments
 (0)