Allow triple-dashes in markdown (#938)
* Allow triple-dashes in markdown * Changeset * Remove the .only
This commit is contained in:
parent
cb7c9d5f82
commit
cd2b5df49c
4 changed files with 27 additions and 1 deletions
5
.changeset/pretty-wolves-flash.md
Normal file
5
.changeset/pretty-wolves-flash.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/parser': patch
|
||||
---
|
||||
|
||||
Prevents locking up checking for --- inside of the HTML portion
|
|
@ -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()) {
|
||||
|
|
|
@ -88,4 +88,11 @@ Markdown('Does not close parent early when using content attribute (#494)', asyn
|
|||
assert.equal($('#target').children().length, 2, '<Markdown content /> 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();
|
||||
|
|
14
packages/astro/test/fixtures/astro-markdown/src/pages/dash.md
vendored
Normal file
14
packages/astro/test/fixtures/astro-markdown/src/pages/dash.md
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
title: My Blog Post
|
||||
layout: ../layouts/content.astro
|
||||
---
|
||||
|
||||
## Title
|
||||
|
||||
Hello world
|
||||
|
||||
With this in the body ---
|
||||
|
||||
## Another
|
||||
|
||||
more content
|
Loading…
Reference in a new issue