forked from dita-ot/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarkdown-dita-syntax-reference.dita
357 lines (344 loc) · 14.8 KB
/
markdown-dita-syntax-reference.dita
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<!-- This file is part of the DITA Open Toolkit project. See the accompanying LICENSE file for applicable license. -->
<topic id="markdown-dita-syntax-reference">
<title>Markdown DITA syntax reference</title>
<titlealts>
<navtitle>Markdown DITA syntax</navtitle>
</titlealts>
<shortdesc>Markdown DITA uses
<xref keyref="commonmark"/> as the underlying markup language.</shortdesc>
<prolog>
<metadata>
<keywords>
<indexterm>Pandoc</indexterm>
<indexterm end="lwdita"/>
<indexterm>UTF</indexterm>
<indexterm>DITA<indexterm>specializations</indexterm></indexterm>
<indexterm>Markdown</indexterm>
<indexterm>CommonMark</indexterm>
</keywords>
</metadata>
</prolog>
<body>
<p>Markdown DITA files must be UTF-8 encoded.</p>
<section id="titles-and-document-structure">
<title>Titles and document structure</title>
<p>Each header level will generate a topic and associated title:</p>
<codeblock outputclass="language-markdown" xml:space="preserve"># Topic title
## Nested topic title</codeblock><codeblock outputclass="language-xml" xml:space="preserve"><topic id="topic_title">
<title>Topic title</title>
<topic id="nested_topic_title">
<title>Nested topic title</title>
</topic>
</topic></codeblock>
<p>Pandoc
<xref format="html#extension-header_attributes" href="http://pandoc.org/MANUAL.html#extension-header_attributes"
scope="external">header_attributes</xref> can be used to define <codeph>id</codeph> or
<codeph>outputclass</codeph> attributes:</p><codeblock outputclass="language-markdown" xml:space="preserve"># Topic title {#carrot .juice}</codeblock><codeblock outputclass="language-xml" xml:space="preserve"><topic id="carrot" outputclass="juice">
<title>Topic title</title></codeblock>
<p>If topic ID is not defined using header_attributes, the ID is generated from title contents.</p>
<p>Pandoc
<xref format="html#extension-pandoc_title_block"
href="http://pandoc.org/MANUAL.html#extension-pandoc_title_block" scope="external">pandoc_title_block</xref>
extension can be used to group multiple level 1 headers under a common
title:</p><codeblock outputclass="language-markdown" xml:space="preserve">% Common title
# Topic title
# Second title</codeblock><codeblock outputclass="language-xml" xml:space="preserve"><topic id="common_title">
<title>Common title</title>
<topic id="topic_title">
<title>Topic title</title>
</topic>
<topic id="second_title">
<title>Second title</title>
</topic>
</topic></codeblock></section>
<section id="topic-content">
<title>Topic content</title>
<p>In LwDITA compatible documents (MDITA) the first paragraph is treated as a <codeph>shortdesc</codeph> element.
In generic Markdown documents all paragraphs appear inside the <codeph>body</codeph> element.</p></section>
<section id="specialization-types">
<title>Specialization types</title>
<p>The following class values in
<xref format="html#extension-header_attributes" href="http://pandoc.org/MANUAL.html#extension-header_attributes"
scope="external">header_attributes</xref> have a special meaning on level 1 headers:</p>
<ul>
<li>
<p><codeph>concept</codeph></p></li>
<li>
<p><codeph>task</codeph></p></li>
<li>
<p><codeph>reference</codeph></p></li>
</ul>
<p>They can be used to change the Markdown DITA topic type to one of the built-in structural specialization
types.</p><codeblock outputclass="language-markdown" xml:space="preserve"># Task {.task}
Context
1. Command
Info.</codeblock><codeblock outputclass="language-xml" xml:space="preserve"><task id="task">
<title>Task </title>
<taskbody>
<context>
<p>Context</p>
</context>
<steps>
<step>
<cmd>Command</cmd>
<info>
<p>Info.</p>
</info>
</step>
</steps>
</taskbody>
</task></codeblock></section>
<section id="sections">
<title>Sections</title>
<p>The following class values in
<xref format="html#extension-header_attributes" href="http://pandoc.org/MANUAL.html#extension-header_attributes"
scope="external">header_attributes</xref> have a special meaning on header levels other than 1:</p>
<ul>
<li>
<p><codeph>section</codeph></p></li>
<li>
<p><codeph>example</codeph></p></li>
</ul>
<p>They are used to generate
<xref format="html" href="http://docs.oasis-open.org/dita/v1.2/os/spec/langref/section.html" scope="external"
><codeph>section</codeph></xref> and
<xref format="html" href="http://docs.oasis-open.org/dita/v1.2/os/spec/langref/example.html" scope="external"
><codeph>example</codeph></xref>
elements:</p><codeblock outputclass="language-markdown" xml:space="preserve"># Topic title
## Section title {.section}
## Example title {.example}</codeblock><codeblock outputclass="language-xml" xml:space="preserve"><topic id="topic_title">
<title>Topic title</title>
<body>
<section>
<title>Section title</title>
</section>
<example>
<title>Example title</title>
</example>
</body>
</topic></codeblock></section>
<section id="links">
<title>Links</title>
<p>The format of local link targets is detected based on file extension. The following extensions are treated as
DITA files:</p>
<table outputclass="table-hover" frame="none" colsep="0" rowsep="1">
<tgroup cols="2">
<colspec/>
<colspec/>
<thead>
<row>
<entry>extension</entry>
<entry>format</entry>
</row>
</thead>
<tbody>
<row>
<entry><codeph>.dita</codeph></entry>
<entry><codeph>dita</codeph></entry>
</row>
<row>
<entry><codeph>.xml</codeph></entry>
<entry><codeph>dita</codeph></entry>
</row>
<row>
<entry><codeph>.md</codeph></entry>
<entry><codeph>markdown</codeph></entry>
</row>
<row>
<entry><codeph>.markdown</codeph></entry>
<entry><codeph>markdown</codeph></entry>
</row>
</tbody>
</tgroup>
</table>
<p>All other link targets use <codeph>format</codeph> from file extension and are treated as non-DITA files.
Absolute links targets are treated as external scope
links:</p><codeblock outputclass="language-markdown" xml:space="preserve">[Markdown](test.md)
[DITA](test.dita)
[HTML](test.html)
[External](http://www.example.com/test.html)</codeblock><codeblock outputclass="language-xml" xml:space="preserve"><xref href="test.md">Markdown</xref>
<xref href="test.dita">DITA</xref>
<xref href="test.html" format="html">HTML</xref>
<xref href="http://www.example.com/test.html" format="html" scope="external">External</xref></codeblock></section>
<section id="images">
<title>Images</title>
<div outputclass="div-index">
<indexterm>images<indexterm>Markdown</indexterm></indexterm>
</div>
<p>Images used in inline content will result in inline placement. If a block level image contains a title, it will
be treated as an image wrapped in
figure:</p><codeblock outputclass="language-markdown" xml:space="preserve">An inline .

</codeblock><codeblock outputclass="language-xml" xml:space="preserve"><p>An inline <image href="test.jpg"><alt>Alt</alt></image>.</p>
<image href="test.jpg" placement="break">
<alt>Alt</alt>
</image>
<fig>
<title>Title</title>
<image href="test.jpg">
<alt>Alt</alt>
</image>
</fig></codeblock></section>
<section id="key-references">
<title>Key references</title>
<p>Key reference can be used with
<xref format="html" href="http://spec.commonmark.org/0.18/#shortcut-reference-link" scope="external">shortcut
reference
links</xref>:</p><codeblock outputclass="language-markdown" xml:space="preserve">[key]
![image-key]</codeblock><codeblock outputclass="language-xml" xml:space="preserve"><xref keyref="key"/>
<image keyref="image-key"/></codeblock></section>
<section id="inline">
<title>Inline</title>
<p>The following inline elements are
supported:</p><codeblock outputclass="language-markdown" xml:space="preserve">**bold**
*italic*
`code`
~~strikethrough~~</codeblock><codeblock outputclass="language-xml" xml:space="preserve"><b>bold</b>
<i>italic</i>
<codeph>code</codeph>
<ph status="deleted">strikethrough</ph></codeblock></section>
<section id="lists">
<title>Lists</title>
<p>Unordered can be marked up with either hyphen or ampersand:</p><codeblock outputclass="language-markdown" xml:space="preserve">* one
* two
- three
- four</codeblock><codeblock outputclass="language-xml" xml:space="preserve"><ul>
<li>one</li>
<li>two
<ul>
<li>three</li>
<li>four</li>
</ul>
</li>
</ul></codeblock>
<p>Ordered can be marked up with either number or number sign, followed by a period:</p><codeblock outputclass="language-markdown" xml:space="preserve">1. one
2. two
#. three
#. four</codeblock><codeblock outputclass="language-xml" xml:space="preserve"><ol>
<li>one</li>
<li>two
<ol>
<li>three</li>
<li>four</li>
</ul>
</li>
</ul></codeblock>
<p>Definition lists use the
<xref format="html" href="http://michelf.com/projects/php-markdown/extra/#def-list" scope="external">PHP
Markdown Extra</xref> format:</p><codeblock outputclass="language-markdown" xml:space="preserve">Term
: Definition.</codeblock><codeblock outputclass="language-xml" xml:space="preserve"><dl>
<delentry>
<dt>Term</dt>
<dd>Defintion.</dd>
</delentry>
</dl></codeblock>
<p>Each definition entry must have only one term and contain only inline content.</p></section>
<section id="tables">
<title>Tables</title>
<div outputclass="div-index">
<indexterm>tables<indexterm>Markdown</indexterm></indexterm>
</div>
<p>Tables use
<xref format="html" href="http://fletcherpenney.net/multimarkdown/" scope="external">MultiMarkdown</xref> table
extension format:</p><codeblock outputclass="language-markdown" xml:space="preserve">| First Header | Second Header | Third Header |
| ------------ | :-----------: | -----------: |
| Content | *Long Cell* ||
| Content | **Cell** | Cell |</codeblock><codeblock outputclass="language-xml" xml:space="preserve"><table>
<tgroup cols="3">
<colspec colname="col1"/>
<colspec colname="col2" align="center"/>
<colspec colname="col3" align="right"/>
<thead>
<row>
<entry>First Header </entry>
<entry>Second Header </entry>
<entry>Third Header </entry>
</row>
</thead>
<tbody>
<row>
<entry>Content </entry>
<entry namest="col2" nameend="col3"><i>Long Cell</i></entry>
</row>
<row>
<entry>Content </entry>
<entry><b>Cell</b></entry>
<entry>Cell </entry>
</row>
</tbody>
</tgroup>
</table></codeblock>
<p>Table cells may only contain inline content and column spans; block content and row spans are not supported by
Markdown DITA.</p></section>
<section id="metadata">
<title>Metadata</title>
<div outputclass="div-index">
<indexterm>metadata<indexterm>Lightweight DITA</indexterm></indexterm>
<indexterm>metadata<indexterm>Markdown</indexterm></indexterm>
<indexterm>Pandoc</indexterm>
</div>
<p>
<xref format="html" href="http://www.yaml.org/" scope="external">YAML</xref> metadata block as defined in Pandoc
<xref format="html#extension-yaml_metadata_block"
href="http://pandoc.org/MANUAL.html#extension-yaml_metadata_block" scope="external"
>pandoc_metadata_block</xref> can be used to specify different metadata elements. The supported elements
are:</p>
<ul>
<li>
<p><codeph>author</codeph></p></li>
<li>
<p><codeph>source</codeph></p></li>
<li>
<p><codeph>publisher</codeph></p></li>
<li>
<p><codeph>permissions</codeph></p></li>
<li>
<p><codeph>audience</codeph></p></li>
<li>
<p><codeph>category</codeph></p></li>
<li>
<p><codeph>keyword</codeph></p></li>
<li>
<p><codeph>resourceid</codeph></p></li>
</ul>
<p>Unrecognized keys are output using <codeph>data</codeph>
element.</p><codeblock outputclass="language-markdown" xml:space="preserve">---
author:
- Author One
- Author Two
source: Source
publisher: Publisher
permissions: Permissions
audience: Audience
category: Category
keyword:
- Keyword1
- Keyword2
resourceid:
- Resourceid1
- Resourceid2
workflow: review
---
# Sample with YAML header</codeblock><codeblock outputclass="language-xml" xml:space="preserve"><title>Sample with YAML header</title>
<prolog>
<author>Author One</author>
<author>Author Two</author>
<source>Source</source>
<publisher>Publisher</publisher>
<permissions view="Permissions"/>
<metadata>
<audience audience="Audience"/>
<category>Category</category>
<keywords>
<keyword>Keyword1</keyword>
<keyword>Keyword2</keyword>
</keywords>
</metadata>
<resourceid appid="Resourceid1"/>
<resourceid appid="Resourceid2"/>
<data name="workflow" value="review"/>
</prolog></codeblock></section>
</body>
</topic>