diff options
author | 2021-05-21 15:52:20 -0500 | |
---|---|---|
committer | 2021-05-21 15:52:20 -0500 | |
commit | 9cdada0bcc5fe3fad6f645ffda5f7e5934c738b5 (patch) | |
tree | 03dba70159fe324e9038460b708e515f3f6e3261 /packages/astro-parser/src | |
parent | 19e20f2c54eaa8f0c2ebec54b071ffc4abd524bd (diff) | |
download | astro-9cdada0bcc5fe3fad6f645ffda5f7e5934c738b5.tar.gz astro-9cdada0bcc5fe3fad6f645ffda5f7e5934c738b5.tar.zst astro-9cdada0bcc5fe3fad6f645ffda5f7e5934c738b5.zip |
Markdown issue cleanup (#224)
* fix: markdown issues
* chore: add changeset
* chore: add missing dep
* perf: parallelize compileHtml for children
Diffstat (limited to 'packages/astro-parser/src')
-rw-r--r-- | packages/astro-parser/src/parse/state/text.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/astro-parser/src/parse/state/text.ts b/packages/astro-parser/src/parse/state/text.ts index eac810a0a..bde2ec5e4 100644 --- a/packages/astro-parser/src/parse/state/text.ts +++ b/packages/astro-parser/src/parse/state/text.ts @@ -8,7 +8,15 @@ export default function text(parser: Parser) { let data = ''; - while (parser.index < parser.template.length && !parser.match('---') && !parser.match('<') && !parser.match('{') && !parser.match('`')) { + const shouldContinue = () => { + // Special case 'code' content to avoid tripping up on user code + if (parser.current().name === 'code') { + return !parser.match('<') && !parser.match('{'); + } + return !parser.match('---') && !parser.match('<') && !parser.match('{') && !parser.match('`'); + } + + while (parser.index < parser.template.length && shouldContinue()) { data += parser.template[parser.index++]; } |