Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove config key from frontmatter? #4764

Closed
sidharthv96 opened this issue Aug 23, 2023 · 1 comment
Closed

Remove config key from frontmatter? #4764

sidharthv96 opened this issue Aug 23, 2023 · 1 comment
Labels
Status: Triage Needs to be verified, categorized, etc

Comments

@sidharthv96
Copy link
Member

          @aloisklink I have a query before we release this. Do we need the config key?

The only other keys in frontmatter are title and displayMode, with the addition of config, the chance of us adding a top level frontmatter key is slim.

So, should we remove the config key, and directly write the config at the root?

      sankey:
        showValues: true
        prefix: $
        suffix: B
        width: 800
        nodeAlignment: left

Originally posted by @sidharthv96 in #4748 (comment)

@github-actions github-actions bot added the Status: Triage Needs to be verified, categorized, etc label Aug 23, 2023
@aloisklink
Copy link
Member

So, should we remove the config key, and directly write the config at the root?

My opinion is no!

Having everything as a separate config means people can easily just copy the config in and out of the frontmatter. E.g., if you have a mermaid-config.json file, you can easily just add it to your YAML frontmatter like:

config: {example: {value: "my huge JSON config here", other_big_values: "...................."}}
title: My title here

It will also help for writing documentation, since when we document how the YAML frontmatter works, we can just say something like "The config key must be some valid MermaidConfig values, see docs in https://mermaid.js.org/config/schema-docs/config.html", instead of documenting something like "The flowchart key must be a valid MermaidConfig flowchart value, the class key must be a valid MermaidConfig class key, ...."

It will also make the code harder to handle, since then we'd need some sort of pre-processing step to split up what values of the frontmatter are part of the config, and which aren't (and we'd have to keep modifying this whenever we add new diagrams (and how would third-party diagrams work?)).

Having everything under the config param seems easier for both the users, and for us from a code maintenance perspective.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc
Projects
None yet
Development

No branches or pull requests

2 participants