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: sanitize code from the TOC #1204

Merged
merged 11 commits into from
Jun 21, 2023
Merged

fix: sanitize code from the TOC #1204

merged 11 commits into from
Jun 21, 2023

Conversation

Florence-Njeri
Copy link
Contributor

Description
The generator docs render XML markup code snippets in the TOC. This PR sanitizes the headers before they are rendered in the TOC.

Related issue(s)
Fix Issue #1186

@netlify
Copy link

netlify bot commented Jan 11, 2023

Deploy Preview for asyncapi-website ready!

Name Link
🔨 Latest commit 2b1d8ba
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/64931d9014704500089a2397
😎 Deploy Preview https://deploy-preview-1204--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@Florence-Njeri Florence-Njeri marked this pull request as draft January 11, 2023 20:14
Copy link
Member

@fmvilas fmvilas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left two suggestions that can improve your code. Also, you have to add string-sanitizer to the package.json file or, otherwise, it won't work outside your machine because it won't be installed (that's why tests are failing).

That said, if the only thing we have to sanitize in ToC is the backtick symbol (`), then also consider just removing it yourself instead of using the string-sanitizer dependency. I'm saying this because the more dependencies we have the slower the project becomes. You can replace the backticks yourself by using https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll:

item.content.replaceAll('`', '')

☝️ this will replace all backticks with "nothing", i.e., will delete them.

Hope that helps!

components/TOC.js Outdated Show resolved Hide resolved
components/TOC.js Outdated Show resolved Hide resolved
Florence-Njeri and others added 3 commits January 13, 2023 21:02
Co-authored-by: Fran Méndez <fmvilas@gmail.com>
Co-authored-by: Fran Méndez <fmvilas@gmail.com>
@Florence-Njeri Florence-Njeri marked this pull request as ready for review January 13, 2023 18:11
@github-actions
Copy link

github-actions bot commented Jan 13, 2023

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 44
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🔴 PWA 30

Lighthouse ran on https://deploy-preview-1204--asyncapi-website.netlify.app/

akshatnema
akshatnema previously approved these changes Jan 15, 2023
Copy link
Member

@akshatnema akshatnema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @Florence-Njeri. Approved ✔️. TOC doesn't have backticks for the headers.

Copy link
Member

@quetzalliwrites quetzalliwrites left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THANK YOUUUU ✨✨✨

@quetzalliwrites
Copy link
Member

hey @fmvilas, we need your approval (or review) as we can't merge without it because you requested changes. ✌🏽

@derberg
Copy link
Member

derberg commented Feb 28, 2023

@fmvilas sir mister please approve as you are our almighty blocker here 😋

@asyncapi-bot asyncapi-bot dismissed stale reviews from quetzalliwrites and akshatnema via 15d5e74 June 6, 2023 19:11
Copy link
Member

@fmvilas fmvilas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL sorry, I don't know how I missed this SINCE FEBRUARY!!

@derberg
Copy link
Member

derberg commented Jun 21, 2023

/rtm

@derberg
Copy link
Member

derberg commented Jun 21, 2023

@allcontributors please add @Florence-Njeri for code

@allcontributors
Copy link
Contributor

@derberg

I've put up a pull request to add @Florence-Njeri! 🎉

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

Successfully merging this pull request may close these issues.

6 participants