downlit_md_* works by traversing the markdown AST generated by Pandoc. It applies highlight() to CodeBlocks and autolink() to inline Code.

Use downlit_md_path() to transform a file on disk; use downlit_md_string() to transform a string containing markdown as part of a larger pipeline.

Needs pandoc 1.19 or later.

downlit_md_path(in_path, out_path, format = NULL)

downlit_md_string(x, format = NULL)

Arguments

in_path, out_path

Input and output paths for markdown file.

format

Pandoc format; defaults to "gfm" if you have pandoc 2.0.0 or greater, otherwise "markdown_github".

x

A string containing markdown.

Value

downlit_md_path() invisibly returns output_path; downlit_md_string() returns a string containing markdown.

Examples

downlit_md_path,Syntax highlight and link a md document,Syntax highlight and link a md document — downlit_md_path,Source: R/downlit-md.R,downlit_md_path.Rd,character(0),c("downlit_md_path", "downlit_md_string"),character(0),list(title = "Description", contents = "

downlit_md_* works by traversing the markdown AST generated by Pandoc.\nIt applies highlight() to CodeBlocks and autolink() to inline Code.

\n

Use downlit_md_path() to transform a file on disk; use\ndownlit_md_string() to transform a string containing markdown as part\nof a larger pipeline.

\n

Needs pandoc 1.19 or later.

"),list(description = "downlit_md_* works by traversing the markdown AST generated by Pandoc.\nIt applies highlight() to CodeBlocks and autolink() to inline Code.\nUse downlit_md_path() to transform a file on disk; use\ndownlit_md_string() to transform a string containing markdown as part\nof a larger pipeline.\nNeeds pandoc 1.19 or later."),downlit_md_path(in_path, out_path, format = NULL) downlit_md_string(x, format = NULL),list(list(name = "in_path, out_path", description = "

Input and output paths for markdown file.

"), list(name = "format", description = "

Pandoc format; defaults to \"gfm\" if you have pandoc 2.0.0 or\ngreater, otherwise \"markdown_github\".

"), list(name = "x", description = "

A string containing markdown.

")),TRUE,
if (rmarkdown::pandoc_available("1.19")) { downlit_md_string("`base::t()`") downlit_md_string("`base::t`") downlit_md_string("* `base::t`") # But don't highlight in headings downlit_md_string("## `base::t`") }
#> [1] "## `base::t`\n"
,list(list(title = "Value", contents = "

downlit_md_path() invisibly returns output_path;\ndownlit_md_string() returns a string containing markdown.

", slug = "value")),2021,list(name = "downlit", version = "0.2.1.9000", authors = "Hadley Wickham"),list(destination = "dev", mode = "release", version_label = "default", version_tooltip = "Released version", in_dev = FALSE),list(root = "../", title = "downlit"),list(),list(type = "default", left = "
  • \n Reference\n
  • \n
  • \n Changelog\n
  • ", right = "
  • \n \n \n \n \n
  • "),list(.present = TRUE),list(version = "1.6.1.9000"),FALSE,list(left = "

    Developed by Hadley Wickham.

    ", right = "

    Site built with pkgdown 1.6.1.9000.

    "),TRUE