diff --git a/src/shared/markdown-it/html.ts b/src/shared/markdown-it/html.ts index 23cf69a1..57bf1193 100644 --- a/src/shared/markdown-it/html.ts +++ b/src/shared/markdown-it/html.ts @@ -202,7 +202,7 @@ function isParseableHtmlBlockToken(token: Token): parsedBlockTokenInfo { const content = token.content; // checks if a token matches `content` OR `
` const matches = - /^(?:(<[a-z0-9]+.*?>)([^<>]+?)(<\/[a-z0-9]+>))$|^(<[a-z0-9]+(?:\s.+?)?\s?\/?>)$/i.exec( + /^(?:(<[a-z0-9]+.*?>)([^<>\n]+?)(<\/[a-z0-9]+>))$|^(<[a-z0-9]+(?:\s.+?)?\s?\/?>)$/i.exec( content ); diff --git a/test/shared/markdown-it/html.test.ts b/test/shared/markdown-it/html.test.ts index 8f440304..a11dd9e1 100644 --- a/test/shared/markdown-it/html.test.ts +++ b/test/shared/markdown-it/html.test.ts @@ -182,6 +182,13 @@ describe("html markdown-it plugin", () => { expect(tokens[1].children[1].type).toBe("html_inline"); expect(tokens[1].children[1].content).toBe(""); }); + + it("should only transform inline html all on the same line", () => { + const markdown = `\ntest\n`; + const tokens = instance.parse(markdown, {}); + expect(tokens).toHaveLength(1); + expect(tokens[0].type).toBe("html_block"); + }); }); describe("html_block", () => {