Skip to content

Commit

Permalink
only check ^<pre> and </pre>$
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Oct 12, 2024
1 parent a4dd449 commit 4d3e7e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/markdown.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
prose_index = function(x, warn = TRUE) {
idx = NULL
# if raw HTML <pre></pre> exists, it should be treated as code block
inside_pre = if (length(p1 <- grep('<pre>', x))) {
p2 = grep('</pre>', x)
inside_pre = if (length(p1 <- grep('^\\s*<pre>', x))) {
p2 = grep('</pre>\\s*$', x)
if (length(p1) == length(p2)) {
idx = rbind(p1, p2)
function(i) any(i > p1 & i < p2)
Expand Down

0 comments on commit 4d3e7e8

Please sign in to comment.