Skip to contents

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.

Usage

md2qmd(input = NULL, output = NULL, yaml_defaults = NULL)

Arguments

input

Path to the source .md file. Must exist.

output

Path for the generated .qmd file. When NULL, replaces the .md extension with .qmd in 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 title and description — these are required by rllmdoc's validation and will cause check_quarto_yaml() to fail if missing. Additional fields (e.g., author, date) are passed through as-is.

Value

Invisibly returns the output path.

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.