Stata 15 help for dyndoc

[P] dyndoc -- Convert dynamic Markdown document to an HTML file


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 to be saved replace replace the target HTML file if it already exists hardwrap replace hard wraps (actual line breaks) with the HTML tag <br> nomsg suppress message of a link to targetfile nostop do not stop when an error occurs -------------------------------------------------------------------------


dyndoc converts a dynamic Markdown document -- a document containing both formatted text and Stata commands -- to an output file in HTML format. Stata processes the Markdown text and Stata dynamic tags (see [P] dynamic tags) and creates the output HTML file. Markdown is a simple markup language with a formatting syntax based on plain text. It is easily converted to an output format such as HTML. Stata dynamic tags allow Stata commands, output, and graphs to be interleaved with Markdown text.

If you want to convert a Markdown document without Stata dynamic tags to an HTML document, see [P] markdown. If you want to convert a plain text file containing Stata dynamic tags to a plain text output file, see [P] dyntext.


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.

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 HTML line break tag <br>.

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 by executing Stata code within the tag.


Suppose we have the file dyndoc_ex.txt containing Markdown-formatted text that includes Stata dynamic tags.

To generate the target HTML file in Stata, we type

. dyndoc dyndoc_ex.txt

The HTML file dyndoc_ex.html is saved.

You can see these and related files at

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index