After attempting to convert Markdown into HTML, I encountered an issue. While the markdown parsed correctly, the rendered output did not match my expectations. Specifically, I expected the headers to automatically appear bold and with a larger font size, but they did not.
Upon inspecting the browser, I noticed that the font-size
and font-weight
properties were overridden by values inherited from tailwind.css:1
. When I manually disabled this inheritance, the headers displayed as intended per my global CSS settings. I am confused about why the tailwind css is replacing the font-size
and font-weight
.
Here is a snippet of my global CSS styling:
@tailwind base;
@tailwind components;
@tailwind utilities;
h1,h2,h3,h4 {
font-weight: 700;
line-height: 1.3333333;
letter-spacing: -.025em;
padding: 1em;
}
h1 {
font-size: 1.5em;
}
h2 {
font-size: 1em;
}
The problematic code resides in the following page:
import Navbar from '../components/Navbar'
const showdown = require('showdown');
const fs = require("fs");
const sop = (props) =>{
return (
<>
<Navbar />
<div className="flex flex-col items-center ">
<div className="w-2/4">
<div dangerouslySetInnerHTML={{ __html:props.body}}/>
</div>
</div>
</>
)
}
export async function getStaticProps(){
let content = fs.readFileSync('./_posts/sop.md','utf8');
let converter = new showdown.Converter();
let html = converter.makeHtml(content);
return {
props : {body:html}
}
}
export default sop
Any guidance on how to resolve this issue would be greatly appreciated.