-
Notifications
You must be signed in to change notification settings - Fork 35
Quarto ::: block breaks word count total #57
Description
Thank you, I think I've got this covered now with 2019a3f
Originally posted by @benmarwick in #51
Hello, it looks like the word count in quarto documents with ::: blocks only includes words which appear before the first occurrence of ::: in the document.
Reproducible example
The text below is plain text in my .qmd file and the code chunks are code chunks:
library(wordcountaddin)
Word count: r wordcountaddin::word_count("my-file.qmd")
Here is some text which adds up to 10 words.
::: {#fig-1}
plot(iris$Sepal.Length)
:::
Here is more text which adds up to 10 words.
Here is more text which adds up to 10 words.
Expected behaviour
The word count should total 32 in this file, but when I render the document to html I get 12. Same if I execute wordcountaddin:::text_stats() with the file open (12 is the koRpus word count). If I move the ::: block in between the next two lines, the output becomes 22. It seems as if all words following the first ::: are ignored
Session info
Not sure if this is needed but providing it for reference anyway
─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.5.2 (2025-10-31 ucrt)
os Windows 11 x64 (build 26200)
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United Kingdom.utf8
ctype English_United Kingdom.utf8
tz Europe/London
date 2026-03-19
rstudio 2026.01.1+403 Apple Blossom (desktop)
pandoc NA
quarto ERROR: Unknown command "TMPDIR=C:/Users/adria/AppData/Local/Temp/RtmpA11rca/file5f5c111c3833". Did you mean command "install"? @ C:\\PROGRA~1\\RStudio\\RESOUR~1\\app\\bin\\quarto\\bin\\quarto.exe
─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
cachem 1.1.0 2024-05-16 [1] CRAN (R 4.5.1)
cli 3.6.5 2025-04-23 [1] CRAN (R 4.5.1)
devtools 2.5.0 2026-03-14 [1] CRAN (R 4.5.2)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.5.2)
fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.5.1)
fs 1.6.7 2026-03-06 [1] CRAN (R 4.5.2)
glue 1.8.0 2024-09-30 [1] CRAN (R 4.5.1)
lifecycle 1.0.5 2026-01-08 [1] CRAN (R 4.5.2)
magrittr 2.0.4 2025-09-12 [1] CRAN (R 4.5.1)
memoise 2.0.1 2021-11-26 [1] CRAN (R 4.5.1)
pkgbuild 1.4.8 2025-05-26 [1] CRAN (R 4.5.2)
pkgload 1.5.0 2026-02-03 [1] CRAN (R 4.5.2)
purrr 1.2.0 2025-11-04 [1] CRAN (R 4.5.2)
R6 2.6.1 2025-02-15 [1] CRAN (R 4.5.1)
rlang 1.1.7 2026-01-09 [1] CRAN (R 4.5.2)
rstudioapi 0.18.0 2026-01-16 [1] CRAN (R 4.5.2)
sessioninfo 1.2.3 2025-02-05 [1] CRAN (R 4.5.2)
usethis 3.2.1 2025-09-06 [1] CRAN (R 4.5.2)
vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.5.1)
Thanks!