2 dyndoc — Convert dynamic Markdown document to HTML or Word (.docx) document
Syntax
dyndoc srcfile
arguments
, options
srcfile is a plain text file containing Markdown-formatted text and Stata dynamic tags.
arguments are stored in the local macros ‘1’, ‘2’, and so on for use in srcfile; see [U] 16.4.1 Argument
passing.
You may enclose srcfile and targetfile in double quotes and must do so if they contain blanks or other
special characters.
options Description
saving(targetfile) specify the target HTML file or Word (.docx) document to be saved
replace replace the target HTML file or Word (.docx) document if it
already exists
hardwrap replace hard wraps (actual line breaks) with the <br> tag in an HTML
file or with line breaks in a Word (.docx) document
nomsg suppress message with a link to targetfile
nostop do not stop when an error occurs
embedimage embed image files as Base64 binary data in the target HTML file
docx output a Word (.docx) document instead of an HTML file
Options
saving(targetfile) specifies the target file to be saved. If saving() is not specified, the target
filename is constructed using the source filename (srcfile) with the .html extension or with the
.docx extension if docx is specified. If the targetfile has the .docx extension, the docx option
is assumed even if it is not specified.
replace specifies that the target file be replaced if it already exists.
hardwrap specifies that hard wraps (actual line breaks) in the Markdown document be replaced with
the <br> tag in the HTML file or with a line break in the Word (.docx) document if the docx
option is specified.
nomsg suppresses the message that contains a link to the target file.
nostop allows the document to continue being processed even if an error occurs. By default, dyndoc
stops processing the document if an error occurs. The error can be caused by either a malformed
dynamic tag or Stata code executed within the tag.
embedimage allows image files to be embedded as data URI (Base64-encoded binary data) in the
HTML file. The supported image file types are portable network graphics (.png), JPEG (.jpg),
tagged image file format (.tif), and graphics interchange format (.gif). This option cannot be
used to embed SVG and PDF image file types.
The image must be specified in a Markdown link; you cannot embed images specified by URLs.
This option is ignored if docx is specified.
docx specifies that the target file be saved in Microsoft Word (.docx) format. If the target file has the
.docx extension, the docx option is implied. The conversion process consists of first producing
an HTML file and then using html2docx to produce the final Word document.