markdown-dita-syntax-reference.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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 2018"><meta name="DC.rights.owner" content="(C) Copyright 2018"><meta name="DC.Type" content="topic"><meta name="description" content="Markdown DITA uses CommonMark as the underlying markup language."><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.0</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/extending-the-ot.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 markdown"><code># Topic title
  14. ## Nested topic title</code></pre><pre class="pre codeblock 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 markdown"><code># Topic title {#carrot .juice}</code></pre><pre class="pre codeblock 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 markdown"><code>% Common title
  29. # Topic title
  30. # Second title</code></pre><pre class="pre codeblock 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 markdown"><code># Task {.task}
  55. Context
  56. 1. Command
  57. Info.</code></pre><pre class="pre codeblock 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 markdown"><code># Topic title
  86. ## Section title {.section}
  87. ## Example title {.example}</code></pre><pre class="pre codeblock 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><table class="table"><caption></caption><colgroup><col><col></colgroup><thead class="thead">
  101. <tr class="row">
  102. <th class="entry" id="markdown-dita-syntax-reference__links__entry__1">extension</th>
  103. <th class="entry" id="markdown-dita-syntax-reference__links__entry__2">format</th>
  104. </tr>
  105. </thead><tbody class="tbody">
  106. <tr class="row">
  107. <td class="entry" headers="markdown-dita-syntax-reference__links__entry__1 "><code class="ph codeph">.dita</code></td>
  108. <td class="entry" headers="markdown-dita-syntax-reference__links__entry__2 "><code class="ph codeph">dita</code></td>
  109. </tr>
  110. <tr class="row">
  111. <td class="entry" headers="markdown-dita-syntax-reference__links__entry__1 "><code class="ph codeph">.xml</code></td>
  112. <td class="entry" headers="markdown-dita-syntax-reference__links__entry__2 "><code class="ph codeph">dita</code></td>
  113. </tr>
  114. <tr class="row">
  115. <td class="entry" headers="markdown-dita-syntax-reference__links__entry__1 "><code class="ph codeph">.md</code></td>
  116. <td class="entry" headers="markdown-dita-syntax-reference__links__entry__2 "><code class="ph codeph">markdown</code></td>
  117. </tr>
  118. <tr class="row">
  119. <td class="entry" headers="markdown-dita-syntax-reference__links__entry__1 "><code class="ph codeph">.markdown</code></td>
  120. <td class="entry" headers="markdown-dita-syntax-reference__links__entry__2 "><code class="ph codeph">markdown</code></td>
  121. </tr>
  122. </tbody></table>
  123. <p class="p">All other link targets use <code class="ph codeph">format</code> from file extension and are treated as non-DITA files.
  124. Absolute links targets are treated as external scope
  125. links:</p><pre class="pre codeblock markdown"><code>[Markdown](test.md)
  126. [DITA](test.dita)
  127. [HTML](test.html)
  128. [External](http://www.example.com/test.html)</code></pre><pre class="pre codeblock xml"><code>&lt;xref href="test.md"&gt;Markdown&lt;/xref&gt;
  129. &lt;xref href="test.dita"&gt;DITA&lt;/xref&gt;
  130. &lt;xref href="test.html" format="html"&gt;HTML&lt;/xref&gt;
  131. &lt;xref href="http://www.example.com/test.html" format="html" scope="external"&gt;External&lt;/xref&gt;</code></pre></section>
  132. <section class="section" id="markdown-dita-syntax-reference__images"><h2 class="title sectiontitle">Images</h2>
  133. <p class="p">Images used in inline content will result in inline placement. If a block level image contains a title, it will
  134. be treated as an image wrapped in
  135. figure:</p><pre class="pre codeblock markdown"><code>An inline ![Alt](test.jpg).
  136. ![Alt](test.jpg)
  137. ![Alt](test.jpg "Title")</code></pre><pre class="pre codeblock 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;
  138. &lt;image href="test.jpg" placement="break"&gt;
  139. &lt;alt&gt;Alt&lt;/alt&gt;
  140. &lt;/image&gt;
  141. &lt;fig&gt;
  142. &lt;title&gt;Title&lt;/title&gt;
  143. &lt;image href="test.jpg"&gt;
  144. &lt;alt&gt;Alt&lt;/alt&gt;
  145. &lt;/image&gt;
  146. &lt;/fig&gt;</code></pre></section>
  147. <section class="section" id="markdown-dita-syntax-reference__key-references"><h2 class="title sectiontitle">Key references</h2>
  148. <p class="p">Key reference can be used with
  149. <a class="xref" href="http://spec.commonmark.org/0.18/#shortcut-reference-link" target="_blank">shortcut
  150. reference
  151. links</a>:</p><pre class="pre codeblock markdown"><code>[key]
  152. ![image-key]</code></pre><pre class="pre codeblock xml"><code>&lt;xref keyref="key"/&gt;
  153. &lt;image keyref="image-key"/&gt;</code></pre></section>
  154. <section class="section" id="markdown-dita-syntax-reference__inline"><h2 class="title sectiontitle">Inline</h2>
  155. <p class="p">The following inline elements are
  156. supported:</p><pre class="pre codeblock markdown"><code>**bold**
  157. *italic*
  158. `code`
  159. ~~strikethrough~~</code></pre><pre class="pre codeblock xml"><code>&lt;b&gt;bold&lt;/b&gt;
  160. &lt;i&gt;italic&lt;/i&gt;
  161. &lt;codeph&gt;code&lt;/codeph&gt;
  162. &lt;ph status="deleted"&gt;strikethrough&lt;/ph&gt;</code></pre></section>
  163. <section class="section" id="markdown-dita-syntax-reference__lists"><h2 class="title sectiontitle">Lists</h2>
  164. <p class="p">Unordered can be marked up with either hyphen or ampersand:</p><pre class="pre codeblock markdown"><code>* one
  165. * two
  166. - three
  167. - four</code></pre><pre class="pre codeblock xml"><code>&lt;ul&gt;
  168. &lt;li&gt;one&lt;/li&gt;
  169. &lt;li&gt;two
  170. &lt;ul&gt;
  171. &lt;li&gt;three&lt;/li&gt;
  172. &lt;li&gt;four&lt;/li&gt;
  173. &lt;/ul&gt;
  174. &lt;/li&gt;
  175. &lt;/ul&gt;</code></pre>
  176. <p class="p">Ordered can be marked up with either number or number sign, followed by a period:</p><pre class="pre codeblock markdown"><code>1. one
  177. 2. two
  178. #. three
  179. #. four</code></pre><pre class="pre codeblock xml"><code>&lt;ol&gt;
  180. &lt;li&gt;one&lt;/li&gt;
  181. &lt;li&gt;two
  182. &lt;ol&gt;
  183. &lt;li&gt;three&lt;/li&gt;
  184. &lt;li&gt;four&lt;/li&gt;
  185. &lt;/ul&gt;
  186. &lt;/li&gt;
  187. &lt;/ul&gt;</code></pre>
  188. <p class="p">Definition lists use the
  189. <a class="xref" href="http://michelf.com/projects/php-markdown/extra/#def-list" target="_blank">PHP
  190. Markdown Extra</a> format:</p><pre class="pre codeblock markdown"><code>Term
  191. : Definition.</code></pre><pre class="pre codeblock xml"><code>&lt;dl&gt;
  192. &lt;delentry&gt;
  193. &lt;dt&gt;Term&lt;/dt&gt;
  194. &lt;dd&gt;Defintion.&lt;/dd&gt;
  195. &lt;/delentry&gt;
  196. &lt;/dl&gt;</code></pre>
  197. <p class="p">Each definition entry must have only one term and contain only inline content.</p></section>
  198. <section class="section" id="markdown-dita-syntax-reference__tables"><h2 class="title sectiontitle">Tables</h2>
  199. <p class="p">Tables use
  200. <a class="xref" href="http://fletcherpenney.net/multimarkdown/" target="_blank">MultiMarkdown</a> table
  201. extension format:</p><pre class="pre codeblock markdown"><code>| First Header | Second Header | Third Header |
  202. | ------------ | :-----------: | -----------: |
  203. | Content | *Long Cell* ||
  204. | Content | **Cell** | Cell |</code></pre><pre class="pre codeblock xml"><code>&lt;table&gt;
  205. &lt;tgroup cols="3"&gt;
  206. &lt;colspec colname="col1"/&gt;
  207. &lt;colspec colname="col2" align="center"/&gt;
  208. &lt;colspec colname="col3" align="right"/&gt;
  209. &lt;thead&gt;
  210. &lt;row&gt;
  211. &lt;entry&gt;First Header &lt;/entry&gt;
  212. &lt;entry&gt;Second Header &lt;/entry&gt;
  213. &lt;entry&gt;Third Header &lt;/entry&gt;
  214. &lt;/row&gt;
  215. &lt;/thead&gt;
  216. &lt;tbody&gt;
  217. &lt;row&gt;
  218. &lt;entry&gt;Content &lt;/entry&gt;
  219. &lt;entry namest="col2" nameend="col3"&gt;&lt;i&gt;Long Cell&lt;/i&gt;&lt;/entry&gt;
  220. &lt;/row&gt;
  221. &lt;row&gt;
  222. &lt;entry&gt;Content &lt;/entry&gt;
  223. &lt;entry&gt;&lt;b&gt;Cell&lt;/b&gt;&lt;/entry&gt;
  224. &lt;entry&gt;Cell &lt;/entry&gt;
  225. &lt;/row&gt;
  226. &lt;/tbody&gt;
  227. &lt;/tgroup&gt;
  228. &lt;/table&gt;</code></pre>
  229. <p class="p">Table cells may only contain inline content and column spans; block content and row spans are not supported by
  230. Markdown DITA.</p></section>
  231. <section class="section" id="markdown-dita-syntax-reference__metadata"><h2 class="title sectiontitle">Metadata</h2>
  232. <p class="p">
  233. <a class="xref" href="http://www.yaml.org/" target="_blank">YAML</a> metadata block as defined in Pandoc
  234. <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
  235. are:</p>
  236. <ul class="ul">
  237. <li class="li">
  238. <p class="p"><code class="ph codeph">author</code></p></li>
  239. <li class="li">
  240. <p class="p"><code class="ph codeph">source</code></p></li>
  241. <li class="li">
  242. <p class="p"><code class="ph codeph">publisher</code></p></li>
  243. <li class="li">
  244. <p class="p"><code class="ph codeph">permissions</code></p></li>
  245. <li class="li">
  246. <p class="p"><code class="ph codeph">audience</code></p></li>
  247. <li class="li">
  248. <p class="p"><code class="ph codeph">category</code></p></li>
  249. <li class="li">
  250. <p class="p"><code class="ph codeph">keyword</code></p></li>
  251. <li class="li">
  252. <p class="p"><code class="ph codeph">resourceid</code></p></li>
  253. </ul>
  254. <p class="p">Unrecognized keys are output using <code class="ph codeph">data</code>
  255. element.</p><pre class="pre codeblock markdown"><code>---
  256. author:
  257. - Author One
  258. - Author Two
  259. source: Source
  260. publisher: Publisher
  261. permissions: Permissions
  262. audience: Audience
  263. category: Category
  264. keyword:
  265. - Keyword1
  266. - Keyword2
  267. resourceid:
  268. - Resourceid1
  269. - Resourceid2
  270. workflow: review
  271. ---
  272. # Sample with YAML header</code></pre><pre class="pre codeblock xml"><code>&lt;title&gt;Sample with YAML header&lt;/title&gt;
  273. &lt;prolog&gt;
  274. &lt;author&gt;Author One&lt;/author&gt;
  275. &lt;author&gt;Author Two&lt;/author&gt;
  276. &lt;source&gt;Source&lt;/source&gt;
  277. &lt;publisher&gt;Publisher&lt;/publisher&gt;
  278. &lt;permissions view="Permissions"/&gt;
  279. &lt;metadata&gt;
  280. &lt;audience audience="Audience"/&gt;
  281. &lt;category&gt;Category&lt;/category&gt;
  282. &lt;keywords&gt;
  283. &lt;keyword&gt;Keyword1&lt;/keyword&gt;
  284. &lt;keyword&gt;Keyword2&lt;/keyword&gt;
  285. &lt;/keywords&gt;
  286. &lt;/metadata&gt;
  287. &lt;resourceid appid="Resourceid1"/&gt;
  288. &lt;resourceid appid="Resourceid2"/&gt;
  289. &lt;data name="workflow" value="review"/&gt;
  290. &lt;/prolog&gt;</code></pre></section>
  291. </div>
  292. <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="As of release 3.0, DITA-OT supports several alternative input formats in addition to standard DITA XML, including Markdown and the proposed 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 MDITA and HDITA authoring formats proposed for Lightweight DITA, or “LwDITA”. These proposed formats are alternative representations of DITA content in Markdown or HTML.">Preview support for Lightweight DITA</a></li></ul></div></nav></article></main></body></html>