Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable use of pandoc --file-scope for input files originating from multiple Rmds #1837

Merged
merged 3 commits into from Jun 8, 2020

Conversation

jjallaire
Copy link
Member

@jjallaire jjallaire commented Jun 4, 2020

Caller must provide a file_scope function used to break apart a markdown file to be passed to pandoc into multiple files. This in turn enables the use of pandoc's --file-scope (https://pandoc.org/MANUAL.html#option--file-scope), which in turn resolves duplicate numeric footnote id's across files.

In the short term this will be used by bookdown to enable correct handling of duplicate numbered footnotes across chapters.

Note that if render() handled multiple input files by passing them all to pandoc, we could make file_scope a boolean or a function (where the boolean would result in just passing --file-scope without any splitting). However, for multiple inputs render() calls itself recursively (meaning that pandoc always gets a single Rmd anyway, so --file-scope would have no meaning).

…rom multiple Rmds.

Caller must provide an md_file_splitter funciton used to break apart a markdown file to be passed to pandoc into multiple files. This in turn enables the use of pandoc's --file-scope, which in turn resolves duplicate numeric footnote id's across files.

In the short term this will be used by bookdown to enable correct handling of duplicate numbered footnotes across chapters.
jjallaire added a commit to rstudio/bookdown that referenced this pull request Jun 4, 2020
…meter.

Numeric footnotes duplicated across chapters are now automatically renumbered. This is done by passing the `--file-scope` argument to pandoc (and having it operate on split out individual chapters of the target .md file rather than a combined file). This behavior can be toggled off by setting `pandoc_file_scope` to `false` in `_bookdown.yml`.

See also rstudio/rmarkdown#1837 (which this PR depends on)
@jjallaire jjallaire requested a review from yihui June 4, 2020 18:06
Copy link
Member

@yihui yihui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@yihui yihui merged commit 028f8c2 into master Jun 8, 2020
@yihui yihui deleted the feature/pandoc-file-scope branch June 8, 2020 04:07
jonathan-g added a commit to jonathan-g/rmarkdown that referenced this pull request Jul 7, 2020
* rstudio/master: (61 commits)
  make metadata available before running pre_knit (rstudio#1855)
  fix rstudio#1815: apply the lua filters pagebreak.lua and latex-div.lua to beamer_presentation
  require the data-latex attribute on fenced Div's again: rstudio#1779 (comment)
  start the next version
  CRAN release v2.3
  fold any code blocks with the class `foldable` for html_document output (rstudio#1835)
  fix rstudio#1828: add aria-hidden = "true" to empty <a> tags in highlighted code blocks generated by Pandoc to improve screen reader accessibility (rstudio#1833)
  add a news item for rstudio#1832
  roxygenize
  no need to turn on --file-scope or actually write the split content into files if the split content is of length < 2
  eliminate renumber_footnotes option
  only test two pandoc versions (devel and RStudio version) and upgrade default to 2.7.3 (rstudio#1846)
  close rstudio#1838: test more R versions on Travis (rstudio#1845)
  renumber_footnotes output format option
  add the <div class="kable-table"> only when the output format is HTML, otherwise the div will be converted to a LaTeX environment, leading to the bug https://stackoverflow.com/q/62340425/559676
  change name of file_scope argument to references_scope
  re-roxygenize
  Add `publish_site()` function for "one-button" publishing of R Markdown websites.
  Enable use of pandoc --file-scope for input files originating from multiple Rmds (rstudio#1837)
  Added missing lang attribute to ioslides_presentation template (rstudio#1841)
  ...
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants