diff --git a/__tests__/renderer-spec.tsx b/__tests__/renderer-spec.tsx index 1df83e1..caaf5c3 100644 --- a/__tests__/renderer-spec.tsx +++ b/__tests__/renderer-spec.tsx @@ -38,6 +38,10 @@ test('should render plain text with simple Class Component', () => { expect((render() as string).trim()).toBe('abcd'); }); +test('should render paragraph with plain text', () => { + expect((render(

abcd

) as string).trim()).toBe('abcd'); +}); + test('should render plain h1 with text', () => { expect((render(

abcd

) as string).trim()).toBe('# abcd'); }); diff --git a/src/tagHandler.ts b/src/tagHandler.ts index 83c964c..3c721e9 100644 --- a/src/tagHandler.ts +++ b/src/tagHandler.ts @@ -6,6 +6,7 @@ import { link, list, listItem, + paragraph, strong, } from 'mdast-builder'; import { AnchorHTMLAttributes, ImgHTMLAttributes } from 'react'; @@ -24,6 +25,13 @@ export default function handleTag( let newParentASTNode: MDASTParent | undefined; switch (tagType) { + // START - Handle paragraph + case 'p': { + newParentASTNode = childASTNode = paragraph(); + break; + } + // END - Handle paragraph + // START - Handle all headings case 'h1': newParentASTNode = childASTNode = heading(1);