markdown-dita-syntax-reference.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <!DOCTYPE html
  2. SYSTEM "about:legacy-compat">
  3. <html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2019"><meta name="DC.rights.owner" content="(C) Copyright 2019"><meta name="DC.type" content="topic"><meta name="description" content="Markdown DITA uses CommonMark as the underlying markup language."><meta name="DC.subject" content="Pandoc, UTF, DITA, specializations, Markdown, CommonMark"><meta name="keywords" content="Pandoc, UTF, DITA, specializations, Markdown, CommonMark"><meta name="DC.relation" scheme="URI" content="../topics/alternative-input-formats.html"><meta name="DC.relation" scheme="URI" content="../topics/markdown-input.html"><meta name="DC.relation" scheme="URI" content="../topics/lwdita-input.html"><meta name="DC.format" content="HTML5"><meta name="DC.identifier" content="markdown-dita-syntax-reference"><link rel="stylesheet" type="text/css" href="../css/commonltr.css"><link rel="stylesheet" type="text/css" href="../css/dita-ot-doc.css"><title>Markdown DITA syntax reference</title></head><body id="markdown-dita-syntax-reference"><header role="banner"><div class="header">
  4. <p>DITA Open Toolkit</p>
  5. <hr>
  6. </div></header><nav role="toc"><ul><li><a href="../index.html">DITA Open Toolkit 3.3</a></li><li><a href="../release-notes/index.html">Release Notes</a></li><li><a href="../topics/installing-client.html">Installing DITA-OT</a></li><li><a href="../topics/alternative-input-formats.html">Authoring formats</a><ul><li><a href="../topics/markdown-input.html">Markdown content</a></li><li><a href="../topics/lwdita-input.html">Lightweight DITA</a></li><li class="active"><a href="../topics/markdown-dita-syntax-reference.html">Markdown DITA syntax</a></li></ul></li><li><a href="../topics/building-output.html">Building output</a></li><li><a href="../parameters/index.html">Setting parameters</a></li><li><a href="../topics/customizing.html">Customizing DITA-OT</a></li><li><a href="../topics/troubleshooting-overview.html">Troubleshooting</a></li><li><a href="../reference/index.html">Reference</a></li><li><a href="../topics/dita-and-dita-ot-resources.html">Resources</a></li></ul></nav><main role="main"><article role="article" aria-labelledby="ariaid-title1">
  7. <h1 class="title topictitle1" id="ariaid-title1">Markdown DITA syntax reference</h1>
  8. <div class="body"><p class="shortdesc">Markdown DITA uses
  9. <a class="xref" href="http://commonmark.org" target="_blank">CommonMark</a> as the underlying markup language.</p>
  10. <p class="p">Markdown DITA files must be UTF-8 encoded.</p>
  11. <section class="section" id="markdown-dita-syntax-reference__titles-and-document-structure"><h2 class="title sectiontitle">Titles and document structure</h2>
  12. <p class="p">Each header level will generate a topic and associated title:</p>
  13. <pre class="pre codeblock language-markdown"><code># Topic title
  14. ## Nested topic title</code></pre><pre class="pre codeblock language-xml"><code>&lt;topic id="topic_title"&gt;
  15. &lt;title&gt;Topic title&lt;/title&gt;
  16. &lt;topic id="nested_topic_title"&gt;
  17. &lt;title&gt;Nested topic title&lt;/title&gt;
  18. &lt;/topic&gt;
  19. &lt;/topic&gt;</code></pre>
  20. <p class="p">Pandoc
  21. <a class="xref" href="http://pandoc.org/MANUAL.html#extension-header_attributes" target="_blank">header_attributes</a> can be used to define <code class="ph codeph">id</code> or
  22. <code class="ph codeph">outputclass</code> attributes:</p><pre class="pre codeblock language-markdown"><code># Topic title {#carrot .juice}</code></pre><pre class="pre codeblock language-xml"><code>&lt;topic id="carrot" outputclass="juice"&gt;
  23. &lt;title&gt;Topic title&lt;/title&gt;</code></pre>
  24. <p class="p">If topic ID is not defined using header_attributes, the ID is generated from title contents.</p>
  25. <p class="p">Pandoc
  26. <a class="xref" href="http://pandoc.org/MANUAL.html#extension-pandoc_title_block" target="_blank">pandoc_title_block</a>
  27. extension can be used to group multiple level 1 headers under a common
  28. title:</p><pre class="pre codeblock language-markdown"><code>% Common title
  29. # Topic title
  30. # Second title</code></pre><pre class="pre codeblock language-xml"><code>&lt;topic id="common_title"&gt;
  31. &lt;title&gt;Common title&lt;/title&gt;
  32. &lt;topic id="topic_title"&gt;
  33. &lt;title&gt;Topic title&lt;/title&gt;
  34. &lt;/topic&gt;
  35. &lt;topic id="second_title"&gt;
  36. &lt;title&gt;Second title&lt;/title&gt;
  37. &lt;/topic&gt;
  38. &lt;/topic&gt;</code></pre></section>
  39. <section class="section" id="markdown-dita-syntax-reference__topic-content"><h2 class="title sectiontitle">Topic content</h2>
  40. <p class="p">In LwDITA compatible documents (MDITA) the first paragraph is treated as a <code class="ph codeph">shortdesc</code> element.
  41. In generic Markdown documents all paragraphs appear inside the <code class="ph codeph">body</code> element.</p></section>
  42. <section class="section" id="markdown-dita-syntax-reference__specialization-types"><h2 class="title sectiontitle">Specialization types</h2>
  43. <p class="p">The following class values in
  44. <a class="xref" href="http://pandoc.org/MANUAL.html#extension-header_attributes" target="_blank">header_attributes</a> have a special meaning on level 1 headers:</p>
  45. <ul class="ul">
  46. <li class="li">
  47. <p class="p"><code class="ph codeph">concept</code></p></li>
  48. <li class="li">
  49. <p class="p"><code class="ph codeph">task</code></p></li>
  50. <li class="li">
  51. <p class="p"><code class="ph codeph">reference</code></p></li>
  52. </ul>
  53. <p class="p">They can be used to change the Markdown DITA topic type to one of the built-in structural specialization
  54. types.</p><pre class="pre codeblock language-markdown"><code># Task {.task}
  55. Context
  56. 1. Command
  57. Info.</code></pre><pre class="pre codeblock language-xml"><code>&lt;task id="task"&gt;
  58. &lt;title&gt;Task &lt;/title&gt;
  59. &lt;taskbody&gt;
  60. &lt;context&gt;
  61. &lt;p&gt;Context&lt;/p&gt;
  62. &lt;/context&gt;
  63. &lt;steps&gt;
  64. &lt;step&gt;
  65. &lt;cmd&gt;Command&lt;/cmd&gt;
  66. &lt;info&gt;
  67. &lt;p&gt;Info.&lt;/p&gt;
  68. &lt;/info&gt;
  69. &lt;/step&gt;
  70. &lt;/steps&gt;
  71. &lt;/taskbody&gt;
  72. &lt;/task&gt;</code></pre></section>
  73. <section class="section" id="markdown-dita-syntax-reference__sections"><h2 class="title sectiontitle">Sections</h2>
  74. <p class="p">The following class values in
  75. <a class="xref" href="http://pandoc.org/MANUAL.html#extension-header_attributes" target="_blank">header_attributes</a> have a special meaning on header levels other than 1:</p>
  76. <ul class="ul">
  77. <li class="li">
  78. <p class="p"><code class="ph codeph">section</code></p></li>
  79. <li class="li">
  80. <p class="p"><code class="ph codeph">example</code></p></li>
  81. </ul>
  82. <p class="p">They are used to generate
  83. <a class="xref" href="http://docs.oasis-open.org/dita/v1.2/os/spec/langref/section.html" target="_blank"><code class="ph codeph">section</code></a> and
  84. <a class="xref" href="http://docs.oasis-open.org/dita/v1.2/os/spec/langref/example.html" target="_blank"><code class="ph codeph">example</code></a>
  85. elements:</p><pre class="pre codeblock language-markdown"><code># Topic title
  86. ## Section title {.section}
  87. ## Example title {.example}</code></pre><pre class="pre codeblock language-xml"><code>&lt;topic id="topic_title"&gt;
  88. &lt;title&gt;Topic title&lt;/title&gt;
  89. &lt;body&gt;
  90. &lt;section&gt;
  91. &lt;title&gt;Section title&lt;/title&gt;
  92. &lt;/section&gt;
  93. &lt;example&gt;
  94. &lt;title&gt;Example title&lt;/title&gt;
  95. &lt;/example&gt;
  96. &lt;/body&gt;
  97. &lt;/topic&gt;</code></pre></section>
  98. <section class="section" id="markdown-dita-syntax-reference__links"><h2 class="title sectiontitle">Links</h2>
  99. <p class="p">The format of local link targets is detected based on file extension. The following extensions are treated as
  100. DITA files:</p>
  101. <table class="table table-hover frame-none"><caption></caption><colgroup><col><col></colgroup><thead class="thead">
  102. <tr class="row">
  103. <th class="entry colsep-0 rowsep-1" id="markdown-dita-syntax-reference__links__entry__1">extension</th>
  104. <th class="entry colsep-0 rowsep-1" id="markdown-dita-syntax-reference__links__entry__2">format</th>
  105. </tr>
  106. </thead><tbody class="tbody">
  107. <tr class="row">
  108. <td class="entry colsep-0 rowsep-1" headers="markdown-dita-syntax-reference__links__entry__1"><code class="ph codeph">.dita</code></td>
  109. <td class="entry colsep-0 rowsep-1" headers="markdown-dita-syntax-reference__links__entry__2"><code class="ph codeph">dita</code></td>
  110. </tr>
  111. <tr class="row">
  112. <td class="entry colsep-0 rowsep-1" headers="markdown-dita-syntax-reference__links__entry__1"><code class="ph codeph">.xml</code></td>
  113. <td class="entry colsep-0 rowsep-1" headers="markdown-dita-syntax-reference__links__entry__2"><code class="ph codeph">dita</code></td>
  114. </tr>
  115. <tr class="row">
  116. <td class="entry colsep-0 rowsep-1" headers="markdown-dita-syntax-reference__links__entry__1"><code class="ph codeph">.md</code></td>
  117. <td class="entry colsep-0 rowsep-1" headers="markdown-dita-syntax-reference__links__entry__2"><code class="ph codeph">markdown</code></td>
  118. </tr>
  119. <tr class="row">
  120. <td class="entry colsep-0 rowsep-1" headers="markdown-dita-syntax-reference__links__entry__1"><code class="ph codeph">.markdown</code></td>
  121. <td class="entry colsep-0 rowsep-1" headers="markdown-dita-syntax-reference__links__entry__2"><code class="ph codeph">markdown</code></td>
  122. </tr>
  123. </tbody></table>
  124. <p class="p">All other link targets use <code class="ph codeph">format</code> from file extension and are treated as non-DITA files.
  125. Absolute links targets are treated as external scope
  126. links:</p><pre class="pre codeblock language-markdown"><code>[Markdown](test.md)
  127. [DITA](test.dita)
  128. [HTML](test.html)
  129. [External](http://www.example.com/test.html)</code></pre><pre class="pre codeblock language-xml"><code>&lt;xref href="test.md"&gt;Markdown&lt;/xref&gt;
  130. &lt;xref href="test.dita"&gt;DITA&lt;/xref&gt;
  131. &lt;xref href="test.html" format="html"&gt;HTML&lt;/xref&gt;
  132. &lt;xref href="http://www.example.com/test.html" format="html" scope="external"&gt;External&lt;/xref&gt;</code></pre></section>
  133. <section class="section" id="markdown-dita-syntax-reference__images"><h2 class="title sectiontitle">Images</h2>
  134. <div class="div div-index">
  135. </div>
  136. <p class="p">Images used in inline content will result in inline placement. If a block level image contains a title, it will
  137. be treated as an image wrapped in
  138. figure:</p><pre class="pre codeblock language-markdown"><code>An inline ![Alt](test.jpg).
  139. ![Alt](test.jpg)
  140. ![Alt](test.jpg "Title")</code></pre><pre class="pre codeblock language-xml"><code>&lt;p&gt;An inline &lt;image href="test.jpg"&gt;&lt;alt&gt;Alt&lt;/alt&gt;&lt;/image&gt;.&lt;/p&gt;
  141. &lt;image href="test.jpg" placement="break"&gt;
  142. &lt;alt&gt;Alt&lt;/alt&gt;
  143. &lt;/image&gt;
  144. &lt;fig&gt;
  145. &lt;title&gt;Title&lt;/title&gt;
  146. &lt;image href="test.jpg"&gt;
  147. &lt;alt&gt;Alt&lt;/alt&gt;
  148. &lt;/image&gt;
  149. &lt;/fig&gt;</code></pre></section>
  150. <section class="section" id="markdown-dita-syntax-reference__key-references"><h2 class="title sectiontitle">Key references</h2>
  151. <p class="p">Key reference can be used with
  152. <a class="xref" href="http://spec.commonmark.org/0.18/#shortcut-reference-link" target="_blank">shortcut
  153. reference
  154. links</a>:</p><pre class="pre codeblock language-markdown"><code>[key]
  155. ![image-key]</code></pre><pre class="pre codeblock language-xml"><code>&lt;xref keyref="key"/&gt;
  156. &lt;image keyref="image-key"/&gt;</code></pre></section>
  157. <section class="section" id="markdown-dita-syntax-reference__inline"><h2 class="title sectiontitle">Inline</h2>
  158. <p class="p">The following inline elements are
  159. supported:</p><pre class="pre codeblock language-markdown"><code>**bold**
  160. *italic*
  161. `code`
  162. ~~strikethrough~~</code></pre><pre class="pre codeblock language-xml"><code>&lt;b&gt;bold&lt;/b&gt;
  163. &lt;i&gt;italic&lt;/i&gt;
  164. &lt;codeph&gt;code&lt;/codeph&gt;
  165. &lt;ph status="deleted"&gt;strikethrough&lt;/ph&gt;</code></pre></section>
  166. <section class="section" id="markdown-dita-syntax-reference__lists"><h2 class="title sectiontitle">Lists</h2>
  167. <p class="p">Unordered can be marked up with either hyphen or ampersand:</p><pre class="pre codeblock language-markdown"><code>* one
  168. * two
  169. - three
  170. - four</code></pre><pre class="pre codeblock language-xml"><code>&lt;ul&gt;
  171. &lt;li&gt;one&lt;/li&gt;
  172. &lt;li&gt;two
  173. &lt;ul&gt;
  174. &lt;li&gt;three&lt;/li&gt;
  175. &lt;li&gt;four&lt;/li&gt;
  176. &lt;/ul&gt;
  177. &lt;/li&gt;
  178. &lt;/ul&gt;</code></pre>
  179. <p class="p">Ordered can be marked up with either number or number sign, followed by a period:</p><pre class="pre codeblock language-markdown"><code>1. one
  180. 2. two
  181. #. three
  182. #. four</code></pre><pre class="pre codeblock language-xml"><code>&lt;ol&gt;
  183. &lt;li&gt;one&lt;/li&gt;
  184. &lt;li&gt;two
  185. &lt;ol&gt;
  186. &lt;li&gt;three&lt;/li&gt;
  187. &lt;li&gt;four&lt;/li&gt;
  188. &lt;/ul&gt;
  189. &lt;/li&gt;
  190. &lt;/ul&gt;</code></pre>
  191. <p class="p">Definition lists use the
  192. <a class="xref" href="http://michelf.com/projects/php-markdown/extra/#def-list" target="_blank">PHP
  193. Markdown Extra</a> format:</p><pre class="pre codeblock language-markdown"><code>Term
  194. : Definition.</code></pre><pre class="pre codeblock language-xml"><code>&lt;dl&gt;
  195. &lt;delentry&gt;
  196. &lt;dt&gt;Term&lt;/dt&gt;
  197. &lt;dd&gt;Defintion.&lt;/dd&gt;
  198. &lt;/delentry&gt;
  199. &lt;/dl&gt;</code></pre>
  200. <p class="p">Each definition entry must have only one term and contain only inline content.</p></section>
  201. <section class="section" id="markdown-dita-syntax-reference__tables"><h2 class="title sectiontitle">Tables</h2>
  202. <div class="div div-index">
  203. </div>
  204. <p class="p">Tables use
  205. <a class="xref" href="http://fletcherpenney.net/multimarkdown/" target="_blank">MultiMarkdown</a> table
  206. extension format:</p><pre class="pre codeblock language-markdown"><code>| First Header | Second Header | Third Header |
  207. | ------------ | :-----------: | -----------: |
  208. | Content | *Long Cell* ||
  209. | Content | **Cell** | Cell |</code></pre><pre class="pre codeblock language-xml"><code>&lt;table&gt;
  210. &lt;tgroup cols="3"&gt;
  211. &lt;colspec colname="col1"/&gt;
  212. &lt;colspec colname="col2" align="center"/&gt;
  213. &lt;colspec colname="col3" align="right"/&gt;
  214. &lt;thead&gt;
  215. &lt;row&gt;
  216. &lt;entry&gt;First Header &lt;/entry&gt;
  217. &lt;entry&gt;Second Header &lt;/entry&gt;
  218. &lt;entry&gt;Third Header &lt;/entry&gt;
  219. &lt;/row&gt;
  220. &lt;/thead&gt;
  221. &lt;tbody&gt;
  222. &lt;row&gt;
  223. &lt;entry&gt;Content &lt;/entry&gt;
  224. &lt;entry namest="col2" nameend="col3"&gt;&lt;i&gt;Long Cell&lt;/i&gt;&lt;/entry&gt;
  225. &lt;/row&gt;
  226. &lt;row&gt;
  227. &lt;entry&gt;Content &lt;/entry&gt;
  228. &lt;entry&gt;&lt;b&gt;Cell&lt;/b&gt;&lt;/entry&gt;
  229. &lt;entry&gt;Cell &lt;/entry&gt;
  230. &lt;/row&gt;
  231. &lt;/tbody&gt;
  232. &lt;/tgroup&gt;
  233. &lt;/table&gt;</code></pre>
  234. <p class="p">Table cells may only contain inline content and column spans; block content and row spans are not supported by
  235. Markdown DITA.</p></section>
  236. <section class="section" id="markdown-dita-syntax-reference__metadata"><h2 class="title sectiontitle">Metadata</h2>
  237. <div class="div div-index">
  238. </div>
  239. <p class="p">
  240. <a class="xref" href="http://www.yaml.org/" target="_blank">YAML</a> metadata block as defined in Pandoc
  241. <a class="xref" href="http://pandoc.org/MANUAL.html#extension-yaml_metadata_block" target="_blank">pandoc_metadata_block</a> can be used to specify different metadata elements. The supported elements
  242. are:</p>
  243. <ul class="ul">
  244. <li class="li">
  245. <p class="p"><code class="ph codeph">author</code></p></li>
  246. <li class="li">
  247. <p class="p"><code class="ph codeph">source</code></p></li>
  248. <li class="li">
  249. <p class="p"><code class="ph codeph">publisher</code></p></li>
  250. <li class="li">
  251. <p class="p"><code class="ph codeph">permissions</code></p></li>
  252. <li class="li">
  253. <p class="p"><code class="ph codeph">audience</code></p></li>
  254. <li class="li">
  255. <p class="p"><code class="ph codeph">category</code></p></li>
  256. <li class="li">
  257. <p class="p"><code class="ph codeph">keyword</code></p></li>
  258. <li class="li">
  259. <p class="p"><code class="ph codeph">resourceid</code></p></li>
  260. </ul>
  261. <p class="p">Unrecognized keys are output using <code class="ph codeph">data</code>
  262. element.</p><pre class="pre codeblock language-markdown"><code>---
  263. author:
  264. - Author One
  265. - Author Two
  266. source: Source
  267. publisher: Publisher
  268. permissions: Permissions
  269. audience: Audience
  270. category: Category
  271. keyword:
  272. - Keyword1
  273. - Keyword2
  274. resourceid:
  275. - Resourceid1
  276. - Resourceid2
  277. workflow: review
  278. ---
  279. # Sample with YAML header</code></pre><pre class="pre codeblock language-xml"><code>&lt;title&gt;Sample with YAML header&lt;/title&gt;
  280. &lt;prolog&gt;
  281. &lt;author&gt;Author One&lt;/author&gt;
  282. &lt;author&gt;Author Two&lt;/author&gt;
  283. &lt;source&gt;Source&lt;/source&gt;
  284. &lt;publisher&gt;Publisher&lt;/publisher&gt;
  285. &lt;permissions view="Permissions"/&gt;
  286. &lt;metadata&gt;
  287. &lt;audience audience="Audience"/&gt;
  288. &lt;category&gt;Category&lt;/category&gt;
  289. &lt;keywords&gt;
  290. &lt;keyword&gt;Keyword1&lt;/keyword&gt;
  291. &lt;keyword&gt;Keyword2&lt;/keyword&gt;
  292. &lt;/keywords&gt;
  293. &lt;/metadata&gt;
  294. &lt;resourceid appid="Resourceid1"/&gt;
  295. &lt;resourceid appid="Resourceid2"/&gt;
  296. &lt;data name="workflow" value="review"/&gt;
  297. &lt;/prolog&gt;</code></pre></section>
  298. </div>
  299. <nav role="navigation" class="related-links"><div class="familylinks"><div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../topics/alternative-input-formats.html" title="DITA-OT³ supports several alternative input formats in addition to standard DITA XML, including Markdown and the proposed XDITA, MDITA and HDITA authoring formats currently in development for Lightweight DITA.">Alternative authoring formats</a></div></div><div class="linklist relinfo"><strong>Related information</strong><br><ul class="linklist"><li class="linklist"><a class="link" href="../topics/markdown-input.html" title="Markdown is a lightweight markup language that allows you to write using an easy-to-read plain text format and convert to structurally valid markup as necessary.">Markdown content</a></li><li class="linklist"><a class="link" href="../topics/lwdita-input.html" title="DITA-OT provides preview support for the authoring formats proposed for Lightweight DITA, or “LwDITA”. The XDITA, MDITA and HDITA formats are alternative representations of DITA content in XML, Markdown and HTML5.">Preview support for Lightweight DITA</a></li></ul></div></nav></article></main></body></html>