Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tailwind CSS: Styling Dynamically Created HTML

Any one figure out a good way to style auto-generated HTML code with Tailwind CSS?

Example: Using a library like Marked to convert Markdown into HTML, which would then be injected into the page.

The key here, is that you do not know the structure of the auto-generated HTML as the markdown could be in any format created by the author.

like image 545
Schleichermann Avatar asked Dec 02 '25 22:12

Schleichermann


1 Answers

npm install @tailwindcss/typography

configure tailwind.config.js plugins:

plugins: [
    require("@tailwindcss/typography")
  ],

use it in component with a special className

  <article className="prose lg:prose-xl">
        <div dangerouslySetInnerHTML={{ __html: dynamicContentHere }} />
      </article>
like image 93
Yilmaz Avatar answered Dec 04 '25 13:12

Yilmaz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!