Skip to content

Markdown tutorial

E. F. Haghish edited this page Aug 28, 2016 · 3 revisions

Although in addition to Markdown, MarkDoc supports HTML and LaTeX markup languages, using Markdown is in general recommended since it notably keeps the do-file easy to read. HTML and LaTeX syntax can reduce the readability of the script file, once it is added to a do-file that already include programming code. However, HTML and LaTeX provide much more control over the document whereas Markdown is a minimalistic language. Yet, the most notable benefit of writing the documentation with Markdown is that MarkDoc can typeset a document that is written with Markdown to several formats such as pdf, html, latex, slide, docx, odt, and epub.

In this section, I review the syntax of Markdown and provide several examples, demonstrating how Markdown can be used within Stata DO-file editor to generate a document.

Headers

Without any syntax, the text written with Markdown appears as text paragraphs. However, writing a header is as simple as adding hash "#" sign before a text line, where a single hash represents header 1 and 6 hashes represent header 6:

# H1
## H2
### H3
#### H4
##### H5
###### H6

This is a text paragraph, which requires no syntax. 

Markdown also provides an alternative syntax for creating header 1 and 2, which further improves the readability of the script file. The alternative syntax makes scanning through the documentation greatly simpler, since the headers will become more distinctive in the script file.

Header 1
========

Header 2
--------