From 41afec1ed898159e1df3bc1157768f2066dd85e5 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 1 Jul 2022 15:36:38 +0200 Subject: Make paragraphs really fast The approach that `micromark-js` takes is as follows: to parse a paragraph, check whether each line starts with something else. If it does, exit, otherwise continue. That is slow, because our actual flow parser does similar things: the work was being done twice. To fix this, this commit introduces parsing each line of a paragraph separately. And finally, when done with flow, combining adjacent paragraphs. This same mechanism is reused for setext headings. Additionally, this commit adds support for interrupting things (or not). E.g., HTML (flow, complete) cannot interrupt paragraphs. Definitions cannot interrupt paragraphs, and connect be interrupted either, but they can follow each other. --- tests/hard_break_escape.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/hard_break_escape.rs') diff --git a/tests/hard_break_escape.rs b/tests/hard_break_escape.rs index c4f6f1d..740e706 100644 --- a/tests/hard_break_escape.rs +++ b/tests/hard_break_escape.rs @@ -40,7 +40,7 @@ fn hard_break_escape() { "should not support escape hard breaks at the end of a heading" ); - // // To do: turning off things. + // // To do: turning things off. // assert_eq!( // micromark("a\\\nb", {extensions: [{disable: {null: ["hardBreakEscape"]}}]}), // "

a\\\nb

", -- cgit