diff --git a/.changeset/pretty-wolves-flash.md b/.changeset/pretty-wolves-flash.md new file mode 100644 index 000000000..709e7e0e4 --- /dev/null +++ b/.changeset/pretty-wolves-flash.md @@ -0,0 +1,5 @@ +--- +'@astrojs/parser': patch +--- + +Prevents locking up checking for --- inside of the HTML portion diff --git a/packages/astro-parser/src/parse/state/text.ts b/packages/astro-parser/src/parse/state/text.ts index 020d066fd..b6509caf9 100644 --- a/packages/astro-parser/src/parse/state/text.ts +++ b/packages/astro-parser/src/parse/state/text.ts @@ -13,7 +13,7 @@ export default function text(parser: Parser) { if (parser.current().name === 'code') { return !parser.match('<') && !parser.match('{'); } - return !parser.match('---') && !parser.match('<') && !parser.match('{') && !parser.match('`'); + return !parser.match('<') && !parser.match('{') && !parser.match('`'); }; while (parser.index < parser.template.length && shouldContinue()) { diff --git a/packages/astro/test/astro-markdown.test.js b/packages/astro/test/astro-markdown.test.js index d696a1649..b8b3c6bb0 100644 --- a/packages/astro/test/astro-markdown.test.js +++ b/packages/astro/test/astro-markdown.test.js @@ -88,4 +88,11 @@ Markdown('Does not close parent early when using content attribute (#494)', asyn assert.equal($('#target').children().length, 2, ' closed div#target early'); }); +Markdown('Can render markdown with --- for horizontal rule', async ({ runtime }) => { + const result = await runtime.load('/dash'); + assert.ok(!result.error, `build error: ${result.error}`); + + // It works! +}); + Markdown.run(); diff --git a/packages/astro/test/fixtures/astro-markdown/src/pages/dash.md b/packages/astro/test/fixtures/astro-markdown/src/pages/dash.md new file mode 100644 index 000000000..269a774f5 --- /dev/null +++ b/packages/astro/test/fixtures/astro-markdown/src/pages/dash.md @@ -0,0 +1,14 @@ +--- +title: My Blog Post +layout: ../layouts/content.astro +--- + +## Title + +Hello world + +With this in the body --- + +## Another + +more content \ No newline at end of file