Skip to content

Commit

Permalink
fix: filter_chunk_end_md should recognize chunk end with extra spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
atusy committed Sep 23, 2021
1 parent 895245b commit 53cfb9e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,13 @@ filter_chunk_end_md = function(chunk.begin, chunk.end, lines) {
in.chunk = FALSE
expected_end = NA_character_
fun = function(is.begin, is.end, line) {
if (in.chunk && is.end && identical(line, expected_end)) {
if (in.chunk && is.end && grepl(expected_end, line)) {
in.chunk <<- FALSE
return(TRUE)
}
if (!in.chunk && is.begin) {
in.chunk <<- TRUE
expected_end <<- sub('(^[\t >]*```+).*', '\\1', line)
expected_end <<- paste0(sub('(^[\t >]*```+).*', '\\1', line), "\\s*$")
}
FALSE
}
Expand Down

0 comments on commit 53cfb9e

Please sign in to comment.