Skip to content

Commit

Permalink
fix: handle code fences better (#402)
Browse files Browse the repository at this point in the history
support more general code fence syntax
  • Loading branch information
zcysxy authored Mar 13, 2022
1 parent 9d34c56 commit 7390905
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ export function parse(
} else if (lines[i] === multilineReversedCardSeparator) {
cardType = CardType.MultiLineReversed;
lineNo = i;
} else if (lines[i].startsWith("```")) {
while (i + 1 < lines.length && !lines[i + 1].startsWith("```")) {
} else if (lines[i].startsWith("```") | lines[i].startsWith("~~~")) {
let codeBlockClose = lines[i].match(/`+|~+/);
while (i + 1 < lines.length && !lines[i + 1].startsWith(codeBlockClose)) {
i++;
cardText += "\n" + lines[i];
}
cardText += "\n" + "```";
cardText += "\n" + codeBlockClose;
i++;
}
}
Expand Down

0 comments on commit 7390905

Please sign in to comment.