I'm facing a puzzling React markdown problem.
Within this snippet:
<ReactMarkdown
className={styles.reactMarkDown}
escapeHtml={false}
components={renderers}
>
{content}
</ReactMarkdown>
I am attempting to apply a background color to the markdown text (content
). The background-color: #some-color
rule in styles.reactMarkDown
doesn't seem to work. I have confirmed that the CSS rule is being applied as the custom font specified in it is displayed correctly.
To work around this issue, I tried using a <span>
element:
<ReactMarkdown
className={styles.reactMarkDown}
escapeHtml={false}
components={renderers}
>
<span className="bg-postbg text-white">{content}</span>
</ReactMarkdown>
However, this causes the text to disappear entirely. Despite searching extensively, I haven't found a solution. What could be causing this unexpected behavior?
Take a look at this image for reference: