Skip to content

tailwindcss/typography integration #242

@acanturk1

Description

@acanturk1

I could not integrate Tailwind CSS with MarkdownPreview.

I am trying to provide a style from TailwindCSS for each heading. It works fine when add the html manually or another markdown editor, but when it is provided via MarkdownPreview, I realised MarkdownPreview style overrides what I am trying to achieve.

Is there any way of handling styles from CSS frameworks?


        <article className="prose prose-h2:text-xl prose-h2:font-medium prose-h2:text-gray-900">
          <MarkdownPreview
            source={`## h2`}
            wrapperElement={{
              "data-color-mode": "light",
              className: "prose prose-h2:text-xl prose-h2:font-medium prose-h2:text-gray-900"
            }}
            rehypeRewrite={(node, index, parent) => {
              if (node.tagName === "a" && parent && /^h(1|2|3|4|5|6)/.test(parent.tagName)) {
                parent.children = parent.children.slice(1)
              }
            }} />
        </article>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions