Search code examples
r-markdownmarkdownquarto

How to keep the markdown header when rendering from qmd to md in Quarto?


When I render a quarto document (.qmd) to markdown (.md) with

quarto render document.qmd -t md

I would like to keep the original markdown metadata header (between the --- markings). How can I make quarto keep it? It cuts it off, but I need it for further processing.


Solution

  • md is not a format for Quarto (or Pandoc) as mentioned by one of the authors: https://github.com/quarto-dev/quarto-cli/issues/5830#issuecomment-1578748592

    quarto render document.qmd -t markdown will convert your document and keep the YAML header. markdown is a Pandoc format but not supported by Quarto, see GitHub issue https://github.com/quarto-dev/quarto-cli/issues/5830.

    It's recommended to use a officially supported format, for example quarto render mwe.qmd --to hugo.

    Input:

    ---
    author: Jane Doe
    title: Foo
    extra: lorem ipsum
    ---
    
    Bar.
    

    Output (quarto render mwe.qmd --to hugo):

    ---
    author: Jane Doe
    title: Foo
    extra: lorem ipsum
    ---
    
    Bar.
    

    Output (quarto render mwe.qmd --to markdown):

    ---
    author:
    - Jane Doe
    extra: lorem ipsum
    title: Foo
    toc-title: Table of contents
    ---
    
    Bar.