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

Fix nested pre/code styles with TypographyStylesProvider #2219

Closed
dasveloper opened this issue Aug 24, 2022 · 1 comment
Closed

Fix nested pre/code styles with TypographyStylesProvider #2219

dasveloper opened this issue Aug 24, 2022 · 1 comment
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)

Comments

@dasveloper
Copy link

What package has an issue

@mantine/core

Describe the bug

When converting Markdown to HTML code blocks like this:

```
{
"firstName": "John",
"lastName": "Smith",
"age": 25
}
```

is converted to nested pre/code tags like this:

<pre>
  <code> 
    {
      "firstName": "John",
      "lastName": "Smith",
      "age": 25
    }
  </code>
</pre>

When that HTML is wrapped in a TypographyStylesProvider, inline code styles are applied to the code tags and then block code styles are applied to the pre tags, creating a broken looking nested styling like this:
Screen Shot 2022-08-23 at 7 20 17 PM

Instead, any code tags wrapped in a pre tag should not have the inline styles applied.

What version of @mantine/hooks page do you have in package.json?

none

If possible, please include a link to a codesandbox with the reproduced problem

No response

Do you know how to fix the issue

No

Are you willing to participate in fixing this issue and create a pull request with the fix

No response

Possible fix

Issue is coming from here where code and pre are styled indepenently:

Possibly use CSS not selector to target code that isn't direct descendant of pre:
https://stackoverflow.com/questions/23853931/how-can-i-style-code-only-if-its-parent-is-not-pre

@rtivital rtivital added Fixed patch Completed issues that will be published with next patch (1.0.X) and removed review required labels Aug 24, 2022
rtivital added a commit that referenced this issue Aug 27, 2022
@rtivital
Copy link
Member

Fixed in 5.2.4

nmay231 pushed a commit to nmay231/mantine that referenced this issue Aug 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)
Projects
None yet
Development

No branches or pull requests

2 participants