From 4d3e7e8bb833ce385111ffb36ff1b3f0a04b8046 Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Fri, 11 Oct 2024 19:19:51 -0500 Subject: [PATCH] only check `^
` and `
$` --- R/markdown.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/markdown.R b/R/markdown.R index b79c305..b0a82e0 100644 --- a/R/markdown.R +++ b/R/markdown.R @@ -14,8 +14,8 @@ prose_index = function(x, warn = TRUE) { idx = NULL # if raw HTML
 exists, it should be treated as code block
-  inside_pre = if (length(p1 <- grep('
', x))) {
-    p2 = grep('
', x) + inside_pre = if (length(p1 <- grep('^\\s*
', x))) {
+    p2 = grep('
\\s*$', x) if (length(p1) == length(p2)) { idx = rbind(p1, p2) function(i) any(i > p1 & i < p2)