Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix#126: Added Rendering of Markdown for Event Descriptions. #128

Closed
wants to merge 1 commit into from

Conversation

ParthJohri
Copy link
Contributor

fix #126 : Added Rendering of Markdown for Event Descriptions

Closes Issue #126

βœ… What type of PR:-

  • 🐞 Bug Fix

πŸ“‘ Description

  1. Installed Showdown.js to convert the markdown text to corresponding html text.
  2. After successfully converting the event description, I replaced the starting <p> tags which was causing the text to be appearing at a larger font size.

formattedEventDescription = formattedEventDescription.replace(/<\/?p>/g, '')

  1. Now to set the description, I used dangerouslySetInnerHTML property to set the formatted description.

<p class="eventItem-description" dangerouslySetInnerHTML={{ __html: ${formattedEventDescription}... }} />

πŸ“Έ Screenshots

Before

Screenshot 2024-07-30 at 21 36 47
Screenshot 2024-07-30 at 21 36 58
Screenshot 2024-07-30 at 21 37 03
Screenshot 2024-07-30 at 21 37 08

After

Screenshot 2024-07-30 at 21 37 15
Screenshot 2024-07-30 at 21 37 21
Screenshot 2024-07-30 at 21 37 24
Screenshot 2024-07-30 at 21 37 30

@ParthJohri
Copy link
Contributor Author

Hi @neozenith ,
Could you please review the PR, and let me know of any suggestions or changes that has to be made?
Thank you!

@JayRovacsek
Copy link
Member

Nice work on this one!

If possible would you mind having a look at ParthJohri#1 I've created against your branch - It was going to be non-trivial to suggest in PR review; but the change-set builds on what you've added and includes dompurify sanitising the html we're injecting into the page.

The risk is minimal that an event will have suitable content to cause issues, happy to let it slide if others are happy with this for now also, but I figured I'd see if it'd work based on this Stack Overflow thread and it does seem to locally (but please feel free to test the change-set also πŸ™‡

Again, thanks for raising this PR!

@neozenith
Copy link
Member

Hi all,

I just took both of your works into PR #136
Thank you @ParthJohri and @JayRovacsek πŸ‘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Render Markdown for Event Descriptions
3 participants