withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
47.05k stars 2.5k forks source link

tailwindcss will be reset mdx's conent style ?? #10232

Closed lkzwc closed 9 months ago

lkzwc commented 9 months ago

Astro Info

"@astrojs/mdx": "^2.1.1",
    "@astrojs/rss": "^4.0.5",
    "@astrojs/sitemap": "^3.1.1",
    "@astrojs/tailwind": "^5.1.0",
    "astro": "^4.4.4",
    "tailwindcss": "^3.4.1"

If this issue only occurs in one browser, which browser is a problem?

google

Describe the Bug

In MDX, the content in MD format will be overwritten by tailwindcss, such as h1 h2, li, and so on

What's the expected result?

this is the fact

image

we want to see, the more info in this repository respository

image

Link to Minimal Reproducible Example

https://github.com/lkzwc/astrodemo

Participation

bluwy commented 9 months ago

This is expected. The default tailwind stylesheet includes a CSS reset which resets the list style. If you want to bring that back, set https://docs.astro.build/en/guides/integrations-guide/tailwind/#applybasestyles to false and import a CSS file with this only:

@tailwind components;
@tailwind utilities;
lkzwc commented 9 months ago

This is expected. The default tailwind stylesheet includes a CSS reset which resets the list style. If you want to bring that back, set https://docs.astro.build/en/guides/integrations-guide/tailwind/#applybasestyles to false and import a CSS file with this only:

@tailwind components;
@tailwind utilities;

Thank you , That's why?

lkzwc commented 9 months ago

https://docs.astro.build/en/guides/integrations-guide/tailwind/#applybasestyles

Is there any way to only set MDX settings? After modifying according to what you said, the other styles on the interface have been modified。

bluwy commented 9 months ago

No, the CSS applies globally. Make sure all your layouts import the CSS file, or if you want to auto apply to all pages like @astrojs/tailwind, you can use an integration:

https://github.com/withastro/astro/blob/03242c6c2259dc583b21c12ad60109ac72aa9d52/packages/integrations/tailwind/src/index.ts#L97-L98

lkzwc commented 9 months ago

No, the CSS applies globally. Make sure all your layouts import the CSS file, or if you want to auto apply to all pages like @astrojs/tailwind, you can use an integration:

https://github.com/withastro/astro/blob/03242c6c2259dc583b21c12ad60109ac72aa9d52/packages/integrations/tailwind/src/index.ts#L97-L98

The MD file will eventually be parsed into an page. so ??

I solve it ,use @tailwindcss/typography ,Whether need to add it for troubleshooting ?