quarto-dev / quarto-dev/quarto-cli

Any way to set global mermaid chunk options?

Open
#7,295 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

diagrams-mermaid enhancement
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Discussed in https://github.com/quarto-dev/quarto-cli/discussions/7279

Originally posted by cjdbarlow October 18, 2023

Description

I would like to define chunk options for styling all mermaid diagrams created in the document, rather than having to manually do it each time. For example, I would like all graphs to use the stepBefore curve style. I can achieve this manually with:

```{mermaid}
%%{ init: { 'flowchart': { 'curve': 'stepBefore' } } }%%

graph_goes_here
```

But this distracts from the focus of the source document, which should be (imo) content rather than styling. I note similar things have been raised before so I am not sure if this is doable? Is there a way to prepend text to different code chunks?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked discussions 7279 and 6209 to understand the proposed scope and prior answers. No implementation files or tests are named in the issue, so locate the existing Mermaid chunk handling and determine how document-wide options could be applied. Done means authors can set the curve style globally without repeating the Mermaid init block in each diagram.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.