Skip to content

Commit

Permalink
fix: display description as variable instead of in the html directly
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan-LukeKlopper committed Jun 6, 2024
1 parent 849f834 commit cbcfafb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/ProposalDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ function ProposalDetails(props) {

const fixDescription = description?.replace(/\\n/g, ' \n')

const parsedDescription = parse(
micromark(fixDescription, { extensions: [gfm()], htmlExtensions: [gfmHtml()] }),
{ replace: transformElement }
);

const transformElement = (node) => {
if (proposal.isSpam && node.name === 'a') {
return <span>{node.children[0].data}</span>;
Expand Down Expand Up @@ -196,7 +201,7 @@ function ProposalDetails(props) {
<div className="col">
<h5 className="mb-3">{title}</h5>
<div className='markdown-container'>
{parse(micromark(fixDescription, {extensions: [gfm()], htmlExtensions: [gfmHtml()]}), { replace: transformElement})}
{parsedDescription}
</div>
</div>
</div>
Expand Down

0 comments on commit cbcfafb

Please sign in to comment.