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

The styles on Markdown are not being applied #768

Open
gianpaj opened this issue Feb 6, 2025 · 1 comment
Open

The styles on Markdown are not being applied #768

gianpaj opened this issue Feb 6, 2025 · 1 comment

Comments

@gianpaj
Copy link

gianpaj commented Feb 6, 2025

The Tailwind classes being set for the different markdown HTML/elements are not working.

h1: ({ node, children, ...props }) => {
return (
<h1 className="text-3xl font-semibold mt-6 mb-2" {...props}>
{children}
</h1>
);

Image

I attempted to reproduce the issue in a smaller repo so we can determine whether the implementation in AI-Chatbot is wrong or is causing the problem.

https://stackblitz.com/edit/prosemirror-react-markdown-qbtuvdd3?file=src%2FApp.tsx

@gianpaj
Copy link
Author

gianpaj commented Feb 6, 2025

If you console.log({ stringFromMarkdown }) in the buildDocumentFromContent() function we do see the HTML elements with classes

{
    "stringFromMarkdown": "<h1 class=\"text-3xl font-semibold mt-6 mb-2\">title</h1>\n<p><span class=\"font-semibold\">bold</span></p>\n<h2 class=\"text-2xl font-semibold mt-6 mb-2\">heading2</h2>"
}

and if you change the <h1> being returned in the components to an <h5> it does change it...

  h1: ({ node, children, ...props }) => {
    return (
      <h5 className="text-3xl font-semibold mt-6 mb-2" {...props}>
        {children}
      </h5>
    );
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant