Skip to content

Feature request: Toggle clean_pandoc2_highlight_tags() in html_document2 #705

@atusy

Description

@atusy

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.name/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('bookdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/bookdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

In html_document2, I faced a failure in line numbering on code blocks powered by pandoc, and found this is caused by clean_pandoc2_highlight_tags.

I asked reasons for the cleaning on RStudio Community, and I got an answer it is probably related to GitBook (https://community.rstudio.com/t/number-lines-on-code-blocks-in-bookdown-htmld-document2-fails-because-of-bookdown-clean-pandoc2-highlight-tags/28985/2).

If this is the case, and cleaning up is not always required, I want an option to toggle the cleaning (e.g., by YAML front matter?).

This feature request enhances other packages depending on bookdown::html_document2 such as pagedown and blogdown.
I'd be verry happy if my suggestion is accepted.

Reproducible example

Please knit followings in html_document and html_document2.

The latter will remove the line numbering on code blocks.

---
output:
  html_document:
    highlight: pygments
  bookdown::html_document2:
    highlight: pygments
---
 
```{r, class.source = "numberLines lineAnchors", eval = FALSE}
iris
```

xfun::session_info('bookdown')

R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch), RStudio 1.2.1335

Locale:
  LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=C             
  LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

Package version:
  base64enc_0.1.3 bookdown_0.9    digest_0.6.18   evaluate_0.13   glue_1.3.1      graphics_3.5.3  grDevices_3.5.3 highr_0.8       htmltools_0.3.6 jsonlite_1.6    knitr_1.22     
  magrittr_1.5    markdown_0.9    methods_3.5.3   mime_0.6        Rcpp_1.0.1      rmarkdown_1.12  stats_3.5.3     stringi_1.4.3   stringr_1.4.0   tinytex_0.11    tools_3.5.3    
  utils_3.5.3     xfun_0.6        yaml_2.2.0     

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions