Prepends YAML frontmatter to an existing .md file and writes the result
as a .qmd file. Use this when onboarding existing markdown documentation
into a Quarto project that requires frontmatter for llms.txt generation.
The original .md file is not modified.
Arguments
- input
Path to the source
.mdfile. Must exist.- output
Path for the generated
.qmdfile. WhenNULL, replaces the.mdextension with.qmdin the same directory. Override to write the converted file to a different location.- yaml_defaults
A named list of frontmatter fields to prepend. At minimum, include
titleanddescription— these are required by rllmdoc's validation and will causecheck_quarto_yaml()to fail if missing. Additional fields (e.g.,author,date) are passed through as-is.
Examples
input <- tempfile(fileext = ".md")
writeLines(c("# Hello", "", "Body content."), input)
output <- md2qmd(input, yaml_defaults = list(
title = "Hello",
description = "A greeting document."
))
cat(readLines(output), sep = "\n")
#> ---
#> title: Hello
#> description: A greeting document.
#> ---
#>
#> # Hello
#>
#> Body content.