Skip to contents

This function converts a .docx file to a .qmd (Quarto markdown) file using Pandoc. It extracts images into a specified directory and can optionally format custom placeholders into Quarto callouts.

Usage

convert_docx_to_qmd(
  input_path = "./original_msdocs/chapter1.docx",
  output_path = "./pages",
  output_name = NULL,
  image_path = "./assets/images",
  overwrite = FALSE,
  relative_image_path = TRUE,
  format_callouts = TRUE
)

Arguments

input_path

A character string specifying the path to the input .docx file.

output_path

A character string specifying the directory to save the output .qmd file. No need for a trailing slash.

output_name

An optional character string for the name of the output file. No need for a file extension. If NULL (the default), the name is derived from input_path.

image_path

A character string specifying the directory to store extracted media. No need for a trailing slash.

overwrite

A logical value indicating whether to overwrite an existing .qmd file. Defaults to FALSE.

relative_image_path

A logical value. If TRUE (the default), the function will correct file paths in the resulting qmd file so that they are relative to the file.

format_callouts

A logical value. If TRUE (the default), the function will call format_qmd() to convert placeholders to callout blocks.

Value

This function is called for its side effects. It writes a .qmd file to the specified output_path and prints status messages to the console.