quarto-dev / quarto-dev/quarto-cli
Improve validation of mermaid code block
Open
@cscheid is already working on this.
Since Nov 8, 2022.
diagrams-mermaid
enhancement
yaml-validation
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Bug description
The following minimal working example
---
title: "MWE"
---
```{mermaid}
%%| label: fig-percentage
%%| fig-cap: Flowchart
flowchart LR
A[Hard edge] --> B(Round edge)
B --> C{Decision}
C --> D[Result one]
C --> E[Result two]
```
```{mermaid}
//| label: fig-slash
//| fig-cap: Flowchart
flowchart LR
A[Hard edge] --> B(Round edge)
B --> C{Decision}
C --> D[Result one]
C --> E[Result two]
```
produces

The build/render log is
pandoc
to: html
output-file: mermaid.html
standalone: true
section-divs: true
html-math-method: mathjax
wrap: none
default-image-extension: png
metadata
document-css: false
link-citations: true
date-format: long
lang: en
title: MWE
Output created: mermaid.html
Would be great to give a warning regarding the wrong code block metadata. For example:
Warning at line 17: mermaid code block uses %%| instead of //|
Warning at line 18: mermaid code block uses %%| instead of //|
Checklist
- Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- Please format your issue so it is easier for us to read the bug report.
- Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- Please document the operating system you're running. If on Linux, please provide the specific distribution.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.