From 7a6ee42b4da918bc7956ab14f299f76643fb4b11 Mon Sep 17 00:00:00 2001 From: tommaso1 Date: Wed, 31 Jan 2024 16:52:39 +0100 Subject: [PATCH] [DEV-1162] Remove workaround from parse content (#585) * parse content * changeset * Update packages/gitbook-docs/src/parseContent.ts Co-authored-by: Marco Ponchia * Update .changeset/wicked-dots-attend.md Co-authored-by: Marco Comi <9998393+kin0992@users.noreply.github.com> --------- Co-authored-by: Marco Ponchia Co-authored-by: Marco Comi <9998393+kin0992@users.noreply.github.com> Co-authored-by: marcobottaro <39835990+marcobottaro@users.noreply.github.com> --- .changeset/wicked-dots-attend.md | 5 +++++ packages/gitbook-docs/src/__tests__/parseContent.test.ts | 2 +- packages/gitbook-docs/src/parseContent.ts | 2 -- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .changeset/wicked-dots-attend.md diff --git a/.changeset/wicked-dots-attend.md b/.changeset/wicked-dots-attend.md new file mode 100644 index 0000000000..b1ecda41f0 --- /dev/null +++ b/.changeset/wicked-dots-attend.md @@ -0,0 +1,5 @@ +--- +"gitbook-docs": patch +--- + +Remove a workaround causing paragraphs to have %p inside tables diff --git a/packages/gitbook-docs/src/__tests__/parseContent.test.ts b/packages/gitbook-docs/src/__tests__/parseContent.test.ts index 42bfa22f3a..e99ecccf3b 100644 --- a/packages/gitbook-docs/src/__tests__/parseContent.test.ts +++ b/packages/gitbook-docs/src/__tests__/parseContent.test.ts @@ -35,7 +35,7 @@ const config = { describe('parseContent', () => { it('should ignore any

tag', () => { expect(parseContent('

Hello there!

', config)).toStrictEqual([ - new Markdoc.Tag('Paragraph', {}, ['Hello there!']), + 'Hello there!', ]); }); it('should parse heading', () => { diff --git a/packages/gitbook-docs/src/parseContent.ts b/packages/gitbook-docs/src/parseContent.ts index bcd1d8f21a..f81159809b 100644 --- a/packages/gitbook-docs/src/parseContent.ts +++ b/packages/gitbook-docs/src/parseContent.ts @@ -44,7 +44,6 @@ const imgR = unpairedHtmlTag('img'); const figureR = pairedHtmlTag('figure'); const figcaptionR = pairedHtmlTag('figcaption'); const markR = pairedHtmlTag('mark'); -const pR = pairedHtmlTag('p'); const detailsR = pairedHtmlTag('details'); const summaryR = pairedHtmlTag('summary'); const fileR = { @@ -101,7 +100,6 @@ export const parseAst = (markdown: string) => { .replaceAll(figureR.regex, figureR.replace) .replaceAll(figcaptionR.regex, figcaptionR.replace) .replaceAll(markR.regex, markR.replace) - .replaceAll(pR.regex, pR.replace) .replaceAll(detailsR.regex, detailsR.replace) .replaceAll(summaryR.regex, summaryR.replace) .replaceAll('{% @figma/embed', '{% figma-embed')