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

.mermaid-config.json not being used #31

Open
reagle opened this issue Aug 14, 2024 · 6 comments
Open

.mermaid-config.json not being used #31

reagle opened this issue Aug 14, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@reagle
Copy link

reagle commented Aug 14, 2024

When I was using -F mermaid-filter it would find styling in .mermaid-config.json. That doesn't seem to be picked up by diagram and I don't see any documentation on what I might be doing wrong.

@reagle
Copy link
Author

reagle commented Aug 14, 2024

Additionally, setting the document's metadata doesn't seem to work either:

---
title: "The column in context"
author: "Joseph Reagle"
date: 2024-08-01
suppress-bibliography: true
diagram:
  cache: true
  engine:
    mermaid:
      mime-types: [image/svg+xml]
      theme: base
      themeVariables:
        primaryColor: "#ffffff"
        primaryTextColor: "#000000"
        primaryBorderColor: "#000000"
        lineColor: "#000000"
        secondaryColor: "#ffffff"
        tertiaryColor: "#ffffff"
---

@tarleb
Copy link
Member

tarleb commented Aug 15, 2024

Sorry, this isn't supported yet, but it would be a good addition. Would you point me to some docs for this? I'm not really familiar with mermaid and its capabilities.

@tarleb tarleb added the enhancement New feature or request label Aug 15, 2024
@reagle
Copy link
Author

reagle commented Aug 15, 2024

I'm a newbie myself and find it confusing, but I first went down that path from mermaid-filter.

Mermaid cli allows you to specify additional options in a json configuration file and a css file. mermaid-filter will look in the current working directory for .mermaid-config.json and .mermaid.css and if found, pass them in to mermaid cli.

There's also these:

I would think/hope the config options would be well documented in mermaid-cli, but that doesn't seem to be the case.

@ngocptblaplafla
Copy link

I made an PR adding some common params for mmdc. With themeVariables, you can write like this example or write an json file with option cssFile
Example metadata

diagram:
  engine:
    mermaid:
      execpath: /usr/local/bin/mmdc
      theme: default
      configFile: 'some file like https://mermaid.js.org/schemas/config.schema.json'
      cssFile: your-theme-variables.json
      puppeteerConfigFile: /etc/puppeteer-conf.json

@cskeeters
Copy link

cskeeters commented Oct 7, 2024

Just want to add my 2 cents here.

One important setting for flowcharts to to set htmlLabels to false. This makes the SVG export use native text and tspan instead of foreignObject. See mermaid-js/mermaid#58

Thankfully, mermaid allows for this setting and the theme to be set in the input file. That means I can configure this in each mermaid section like so:

```mermaid {caption="Every Process a Nike"}
---
config:
  theme: neutral
  flowchart:
    htmlLabels: false
---
flowchart LR
    START(Start) --> DOIT[Just Do It] --> END(End)
```

@reagle
Copy link
Author

reagle commented Oct 31, 2024

Thank you for the PR @ngocptblaplafla. I wonder what needs to happen next? I'd love to try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants