mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
71.82k stars 6.52k forks source link

Google Font support #5701

Open mrleblanc101 opened 2 months ago

mrleblanc101 commented 2 months ago

Description

I use this config:

{
    theme: 'dark',
    fontFamily: 'Inter',
}

I see font-familly: Inter;, but when I inspect the rendered font is Times. I know that Inter is loaded and works and this is the font that is displayed on the rest of my website.

Steps to reproduce

  1. Add a Google font following Google recommandations:
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:slnt,wght@-10..0,100..900&display=swap" rel="stylesheet">
  2. Configurer mermaid with this config:é
    {
    theme: 'dark',
    fontFamily: 'Inter',
    }
  3. Inspect the page

Screenshots

Screenshot 2024-08-08 at 2 01 08 PM Screenshot 2024-08-08 at 2 02 08 PM

Code Sample

No response

Setup

Suggested Solutions

No response

Additional Context

No response

mrleblanc101 commented 2 months ago

If I use a build-in font instead of a Google font like monospace, it works: Screenshot 2024-08-08 at 2 03 31 PM