import regex
This commit is contained in:
parent
638f48c2fc
commit
222e8e19c9
2 changed files with 9 additions and 1 deletions
|
@ -5,7 +5,7 @@ import text from './text.js';
|
|||
import { Parser } from '../index.js';
|
||||
|
||||
export default function fragment(parser: Parser) {
|
||||
if (parser.match('---')) {
|
||||
if (parser.html.children.length === 0 && parser.match_regex(/^---/m)) {
|
||||
return setup;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,14 @@
|
|||
import { Parser } from '../index.js';
|
||||
|
||||
export default function setup(parser: Parser): void {
|
||||
// TODO: Error if not at top of file? currently, we ignore / just treat as text.
|
||||
// if (parser.html.children.length > 0) {
|
||||
// parser.error({
|
||||
// code: 'unexpected-token',
|
||||
// message: 'Frontmatter scripts only supported at the top of file.',
|
||||
// });
|
||||
// }
|
||||
|
||||
const start = parser.index;
|
||||
parser.index += 3;
|
||||
const content_start = parser.index;
|
||||
|
|
Loading…
Reference in a new issue