Skip to contents

These drivers replace the like-named rmarkdown or markdown drivers with ones that output Commonmark rather than Pandoc Markdown. Commonmark is a dialect of Markdown. The Pandoc driver for Commonmark supports output of source position information. By using this function as your output driver, you can get that in your own documents.

A replacement for markdown::latex_format is not planned; see the note below.

Usage

html_documentC(sourcepos = TRUE, ...)
html_vignetteC(sourcepos = TRUE, ...)
pdf_documentC0(latex_engine = "pdflatex",
           sourcepos = TRUE,
           defineSconcordance = TRUE,
           ...)
html_formatC(options = list(sourcepos = TRUE), ...)

Arguments

latex_engine

Command to convert .tex file to .pdf.

defineSconcordance

If TRUE, insert a definition of the \Sconcordance macro just before \begin{document}.

sourcepos

Whether to include source position information.

options

The options argument to pass to the base driver. If options$sourcepos is not specified, it will default to TRUE.

...

Other arguments to pass to the base driver.

Details

Each driver modifies the standard driver from rmarkdown or markdown, e.g. html_documentC is similar to html_document, but uses Commonmark and adds concordances.

Note

The pdf_documentC0 function adds the concordances, but they won't be interpreted by LaTeX or PDF previewers. To get that to happen, use patchDVI::pdf_documentC.

The html_formatC function requires markdown version 1.12.1 or higher. If a lower version of that package is installed html_formatC will still run, but will issue a warning and not add any concordances.

The concordances produced by html_formatC tend to be off by a few lines as the underlying Commonmark processor only issues source position records once per paragraph.

A latex_formatC driver appears as if it would be quite messy and is not currently planned. The issues are:

  • commonmark doesn't support source position attributes in LaTeX output

  • It doesn't allow edits between the parsing and rendering steps. This is what pdf_documentC does.

  • A possible strategy would be to render first to XML (which does keep source position attributes), then convert the XML to LaTeX with macros inserted to record source positions. However, markdown::latex_format produces the final LaTeX document in several steps, and would have to support this two-stage rendering on some but not all of the steps.

Value

An R Markdown output format object which will add concordance information.

Author

Duncan Murdoch