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

Rendering should not depend on a CSS reset #4907

Open
silverwind opened this issue Oct 4, 2023 · 1 comment
Open

Rendering should not depend on a CSS reset #4907

silverwind opened this issue Oct 4, 2023 · 1 comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@silverwind
Copy link
Contributor

silverwind commented Oct 4, 2023

Description

The mermaid rendering depends on certain CSS styles like p {margin: 0} to correctly render, which is bad because it forces a dependency on a CSS reset (which one?) onto the consumer.

On mermaid.live these styles are provided by the tailwindcss base, but it should not be assumed that the consumer also uses tailwindcss or any other CSS reset. It should render correctly with default browser styles.

Steps to reproduce

  1. Open https://mermaid.live/edit#pako:eNolizEKwzAMAL9iNJq8wHO7dUoyaohqq4lpLAdhE4rx35vS7TjuGvgcGBy89nz6jbSYx4gy36e5NYTF2pElsEZZzaH5uXOydkHoHQZIrIliuO6GYgxC2TgxgrswkL4RUH4d1ZKnj3hwRSsPUI9AhW-RVqX0l_0Lhvsu7Q
  2. Disable the following CSS rule from tailwind base in browser DevTools:
blockquote, dd, dl, figure, h1, h2, h3, h4, h5, h6, hr, p, pre {
  margin: 0;
}

Screenshots

Actual:

image

Expected:

image

Setup

  • Mermaid version: 10.5.0
  • Browser and Version: all

Suggested Solutions

Either add the missing styles via JavaScript or provide a (hopefully scoped) CSS file as part of the npm module so that mermaid charts render correctly with default browser styles.

@silverwind silverwind added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Oct 4, 2023
@shakthi2003-ice
Copy link

Hey
can you please assign me this issue

@silverwind silverwind changed the title Incorrect rendering without a CSS reset on the page mermaid rendering should not depend on a CSS reset Oct 7, 2023
lunny pushed a commit to go-gitea/gitea that referenced this issue Oct 8, 2023
KN4CK3R pushed a commit to go-gitea/gitea that referenced this issue Oct 8, 2023
KN4CK3R pushed a commit to go-gitea/gitea that referenced this issue Oct 8, 2023
@silverwind silverwind changed the title mermaid rendering should not depend on a CSS reset Rendering should not depend on a CSS reset Oct 20, 2023
@jgreywolf jgreywolf added include roadmap items to add to roadmap for auto workflow and removed include roadmap items to add to roadmap for auto workflow labels Nov 16, 2023
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 Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

No branches or pull requests

3 participants