From efaf39568a044db918853a02383a69ace88398d9 Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Tue, 15 Apr 2025 12:49:01 -0500 Subject: [PATCH 1/2] start the next version --- DESCRIPTION | 2 +- NEWS.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 27b751e8..c5d27c58 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: bookdown Type: Package Title: Authoring Books and Technical Documents with R Markdown -Version: 0.43 +Version: 0.43.1 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), person("Christophe", "Dervieux", , "cderv@posit.co", role = c("ctb"), diff --git a/NEWS.md b/NEWS.md index cc999d59..62d5f352 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +# CHANGES IN bookdown VERSION 0.44 + + # CHANGES IN bookdown VERSION 0.43 - Support `split_by` for section level higher than `2` (i.e., `##` sections) in `gitbook` (thanks, @katrinabrock #1490, @lcougnaud #1346 #1347). From d7888712a1e0fcd664acf2e841272649088fe312 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Wed, 16 Apr 2025 18:43:00 +0200 Subject: [PATCH 2/2] Adapt regex detection to Pandoc 3 figures to still get numbering (#1496) --- DESCRIPTION | 2 +- NEWS.md | 2 ++ R/html.R | 4 ++-- tests/testthat/resources/figures.Rmd | 23 +++++++++++++++++++++++ tests/testthat/resources/md.png | Bin 0 -> 1716 bytes tests/testthat/test-html.R | 24 ++++++++++++++++++++++++ 6 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 tests/testthat/resources/figures.Rmd create mode 100644 tests/testthat/resources/md.png diff --git a/DESCRIPTION b/DESCRIPTION index c5d27c58..a2594340 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: bookdown Type: Package Title: Authoring Books and Technical Documents with R Markdown -Version: 0.43.1 +Version: 0.43.2 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), person("Christophe", "Dervieux", , "cderv@posit.co", role = c("ctb"), diff --git a/NEWS.md b/NEWS.md index 62d5f352..a702c347 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # CHANGES IN bookdown VERSION 0.44 +- Figure numbering is now correctly working in HTML with Pandoc 3, when Markdown syntax is used to include images (thanks, @N0rbert, #1467). + # CHANGES IN bookdown VERSION 0.43 diff --git a/R/html.R b/R/html.R index 31b5ea17..5739ca10 100644 --- a/R/html.R +++ b/R/html.R @@ -740,7 +740,7 @@ parse_fig_labels = function(content, global = FALSE) { m = gregexpr(sprintf('\\(#((%s):[-/[:alnum:]]+)\\)', reg_label_types), content) labs = regmatches(content, m) cntr = new_counters(label_types, chaps) # chapter counters - figs = grep('^
', content) for (i in seq_along(labs)) { @@ -764,7 +764,7 @@ parse_fig_labels = function(content, global = FALSE) { arry = c(arry, setNames(num, lab)) switch(type, fig = { - if (length(grep('^

= "3") { + "//div[@class='figcaption']" + } else { + "//p[@class='caption']" + } + figure <- xml2::xml_find_first(content, xpath) + expect_match(xml2::xml_text(figure), "Figure 1.1", fixed = TRUE) + +}) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy