I am working on a Vue + Nuxt + Tailwind project and using the marked library to convert a text into markdown.
The issue is that some styles like "Headings" and "Link" are loading properly, while some basic styles like "bold", "italics" are working fine.
For example:
Not sure what the issue is here. If any more details are required, please let me know.
The solution to this was using Tailwind CSS's typography plugin.
Install the plugin first.
npm install @tailwindcss/typography
yarn add @tailwindcss/typography
.
Then add the plugin to your tailwind.config.js
file:
// tailwind.config.js
module.exports = {
theme: {
// ...
},
plugins: [
require('@tailwindcss/typography'),
// ...
],
}
Then add the prose
class to the element where you are displaying the markdown.
<div class="prose" v-html="cleanedMarkdown"></div>
.
This provided the needed formatting for the markdown.