Skip to contents

This function converts a Word (`.docx`) file to Markdown using Pandoc. Optionally, it embeds images as Base64 for a self-contained Markdown file.

Usage

word_to_md(
  docx_file,
  output_file = NULL,
  embed_images = FALSE,
  overwrite = FALSE
)

Arguments

docx_file

Path to the input Word file.

output_file

Path to the final Markdown output file. If null, the original file name.

embed_images

Logical. If `TRUE`, all images will be embedded as Base64. Default is `FALSE`.

overwrite

Logical. If `TRUE`, Output file is overwrote. Default is `FALSE`

Value

Saves a Markdown file (optionally with Base64-embedded images).

Examples

# Convert Word to Markdown without embedding images
if (FALSE) { # \dontrun{
convert_word_to_markdown("input.docx", "output.md", embed_images = FALSE)

# Convert and embed images as Base64
convert_word_to_markdown("input.docx", "output_embedded.md", embed_images = TRUE)
} # }