Allow triple-dashes in markdown (#938)

* Allow triple-dashes in markdown

* Changeset

* Remove the .only
This commit is contained in:
Matthew Phillips 2021-07-29 16:20:49 -04:00 committed by GitHub
parent cb7c9d5f82
commit cd2b5df49c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/parser': patch
---
Prevents locking up checking for --- inside of the HTML portion

View file

@ -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()) {

View file

@ -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();

View file

@ -0,0 +1,14 @@
---
title: My Blog Post
layout: ../layouts/content.astro
---
## Title
Hello world
With this in the body ---
## Another
more content