From 0882d0a146cd07fd42e0fed2d319de9047be009b Mon Sep 17 00:00:00 2001 From: Florence-Njeri Date: Tue, 10 Jan 2023 20:32:31 +0300 Subject: [PATCH 1/4] sanitize code from the TOC --- components/TOC.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/TOC.js b/components/TOC.js index 53528e9313f5..a5a66f5ac8c4 100644 --- a/components/TOC.js +++ b/components/TOC.js @@ -2,6 +2,7 @@ import { useState } from 'react' import Scrollspy from 'react-scrollspy' import { twMerge } from "tailwind-merge"; import ArrowRight from './icons/ArrowRight' +var string = require("string-sanitizer"); export default function TOC({ className, @@ -46,7 +47,7 @@ export default function TOC({ href={`#${item.slug}`} key={index} > - {item.content} + {string.sanitize.keepSpace(item.content)} )) } From edd8be74fc31f80ea9bbcbaa03521c3d38c0f85f Mon Sep 17 00:00:00 2001 From: Florence Njeri <40742916+Florence-Njeri@users.noreply.github.com> Date: Fri, 13 Jan 2023 21:02:02 +0300 Subject: [PATCH 2/4] Update components/TOC.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fran Méndez --- components/TOC.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/TOC.js b/components/TOC.js index a5a66f5ac8c4..8278355f3d1d 100644 --- a/components/TOC.js +++ b/components/TOC.js @@ -2,7 +2,7 @@ import { useState } from 'react' import Scrollspy from 'react-scrollspy' import { twMerge } from "tailwind-merge"; import ArrowRight from './icons/ArrowRight' -var string = require("string-sanitizer"); +import stringSanitizer from 'string-sanitizer' export default function TOC({ className, From 25a48511d0461e9accc2cb46827360022447bf76 Mon Sep 17 00:00:00 2001 From: Florence Njeri <40742916+Florence-Njeri@users.noreply.github.com> Date: Fri, 13 Jan 2023 21:02:18 +0300 Subject: [PATCH 3/4] Update components/TOC.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fran Méndez --- components/TOC.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/TOC.js b/components/TOC.js index 8278355f3d1d..b97292727d35 100644 --- a/components/TOC.js +++ b/components/TOC.js @@ -47,7 +47,7 @@ export default function TOC({ href={`#${item.slug}`} key={index} > - {string.sanitize.keepSpace(item.content)} + {stringSanitizer.sanitize.keepSpace(item.content)} )) } From b4f8b77a705e912f10204143a2084c693f1398f4 Mon Sep 17 00:00:00 2001 From: Florence-Njeri Date: Fri, 13 Jan 2023 21:11:16 +0300 Subject: [PATCH 4/4] sanitize the TOC --- components/TOC.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/TOC.js b/components/TOC.js index b97292727d35..7758d7fad47d 100644 --- a/components/TOC.js +++ b/components/TOC.js @@ -2,7 +2,6 @@ import { useState } from 'react' import Scrollspy from 'react-scrollspy' import { twMerge } from "tailwind-merge"; import ArrowRight from './icons/ArrowRight' -import stringSanitizer from 'string-sanitizer' export default function TOC({ className, @@ -47,7 +46,7 @@ export default function TOC({ href={`#${item.slug}`} key={index} > - {stringSanitizer.sanitize.keepSpace(item.content)} + {item.content.replaceAll('`', '')} )) }