Skip to content

Diagram Font Scaling #2

@jonas-haeusler

Description

@jonas-haeusler

Description

LikeC4 diagram fonts are rendering at 125% of their intended size when embedded in MkDocs.

Root Cause

  • MkDocs Material sets the root font size to 20px (instead of the standard 16px) and resets body inline elements back to 10px (issue #911)
  • LikeC4 uses rem units for font scaling, which inherit from the root font size, even through the shadow dom of the web component
  • LikeC4's rem calculations assume a 16px root font size (source)

References

Reproducing the error

  • Clone this repo
  • Run the sample project: ./local-preview
  • Run the likec4 preview alongside: npx likec4 start docs
  • Compare the resulting diagrams:
    Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions