docgen-tool 2.1.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +1 -0
- package/.github/workflows/deploy-website.yml +28 -0
- package/.prettierignore +4 -0
- package/.prettierrc +4 -0
- package/LICENSE +35 -33
- package/{docgen → dist/docgen.js} +11 -22
- package/docgen.js +95 -0
- package/package.json +47 -20
- package/source/__test__/test-run/contents.json +12 -0
- package/source/__test__/test-run/overview.txt +3 -0
- package/source/__test__/test-run/parameters.json +32 -0
- package/source/__test__/test-run/release-notes.txt +4 -0
- package/source/docgen.js +900 -775
- package/source/example/contents.json +11 -11
- package/source/example/index.txt +3 -3
- package/source/example/parameters.json +36 -36
- package/source/internal-readme.md +4 -0
- package/source/pdf-stylesheet.css +26 -20
- package/source/require/docgen.css +76 -69
- package/source/require/katexInjector.js +9 -13
- package/source/require/print.css +26 -19
- package/source/templates/main.html +93 -93
- package/source/user-guide/advanced-content.txt +170 -170
- package/source/user-guide/contents.json +56 -56
- package/source/user-guide/files/images/svg/inkit-logo.svg +9 -0
- package/source/user-guide/index.txt +257 -244
- package/source/user-guide/installation.txt +49 -49
- package/source/user-guide/parameters.json +36 -36
- package/source/user-guide/release-notes.txt +69 -58
- package/source/user-guide/running.txt +46 -46
- package/source/user-guide/troubleshooting.txt +31 -31
- package/source/user-guide/upgrading.txt +25 -25
- package/source/user-guide/version-control.txt +13 -13
- package/source/user-guide/writing-content.txt +269 -269
- package/tsconfig.json +8 -0
- package/.npmignore +0 -2
- package/docs/advanced-content.html +0 -239
- package/docs/commonmark.html +0 -225
- package/docs/docgen.pdf +0 -0
- package/docs/files/images/overview.png +0 -0
- package/docs/files/images/pdf.png +0 -0
- package/docs/files/images/svg/icon.svg +0 -845
- package/docs/files/images/svg/overview.svg +0 -1345
- package/docs/files/images/text.png +0 -0
- package/docs/files/images/web.png +0 -0
- package/docs/index.html +0 -333
- package/docs/installation.html +0 -121
- package/docs/ownership.html +0 -164
- package/docs/release-notes.html +0 -144
- package/docs/require/docgen.css +0 -131
- package/docs/require/katex/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/docs/require/katex/fonts/KaTeX_Main-Bold.woff +0 -0
- package/docs/require/katex/fonts/KaTeX_Main-Italic.woff +0 -0
- package/docs/require/katex/fonts/KaTeX_Main-Regular.woff +0 -0
- package/docs/require/katex/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/docs/require/katex/fonts/KaTeX_Math-Italic.woff +0 -0
- package/docs/require/katex/fonts/KaTeX_Math-Regular.woff +0 -0
- package/docs/require/katex/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/docs/require/katex/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/docs/require/katex/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/docs/require/katex/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/docs/require/katex/katex.min.css +0 -1
- package/docs/require/katex/katex.min.js +0 -6
- package/docs/require/katexInjector.js +0 -22
- package/docs/require/print.css +0 -19
- package/docs/require/webknife/fonts/DroidSansMono.woff +0 -0
- package/docs/require/webknife/fonts/OpenSans.woff +0 -0
- package/docs/require/webknife/fonts/OpenSansBold.woff +0 -0
- package/docs/require/webknife/fonts/OpenSansBoldItalic.woff +0 -0
- package/docs/require/webknife/fonts/OpenSansItalic.woff +0 -0
- package/docs/require/webknife/framework.icons.js +0 -82
- package/docs/require/webknife/framework.min.css +0 -3
- package/docs/require/webknife/framework.min.js +0 -14
- package/docs/require/webknife/highlight.min.css +0 -1
- package/docs/require/webknife/highlight.min.js +0 -6
- package/docs/running.html +0 -123
- package/docs/troubleshooting.html +0 -105
- package/docs/upgrading.html +0 -124
- package/docs/version-control.html +0 -102
- package/docs/writing-content.html +0 -305
- /package/{docs → source/__test__/test-run}/files/images/logo.png +0 -0
|
@@ -1,269 +1,269 @@
|
|
|
1
|
-
<style>
|
|
2
|
-
.container {
|
|
3
|
-
box-sizing: border-box;
|
|
4
|
-
float:left;
|
|
5
|
-
width: 480px;
|
|
6
|
-
}
|
|
7
|
-
.codeContainer {
|
|
8
|
-
margin: 0 20px 0 0;
|
|
9
|
-
}
|
|
10
|
-
.codeContainer pre {
|
|
11
|
-
margin: 0;
|
|
12
|
-
}
|
|
13
|
-
.codeContainer code {
|
|
14
|
-
}
|
|
15
|
-
.codeContainer p {
|
|
16
|
-
margin: 0;
|
|
17
|
-
padding: 0;
|
|
18
|
-
}
|
|
19
|
-
.exampleContainer {
|
|
20
|
-
margin: 0;
|
|
21
|
-
border: 1px solid #666;
|
|
22
|
-
border-radius: 6px;
|
|
23
|
-
padding: 0 18px 0 18px;
|
|
24
|
-
}
|
|
25
|
-
.exampleContainer img {
|
|
26
|
-
margin-top: 5px;
|
|
27
|
-
}
|
|
28
|
-
#content table {
|
|
29
|
-
width: 400px!important;
|
|
30
|
-
}
|
|
31
|
-
.hljs-change {
|
|
32
|
-
background-color: transparent!important;
|
|
33
|
-
}
|
|
34
|
-
</style>
|
|
35
|
-
|
|
36
|
-
Content for a DocGen website is authored in plain text, using any text editor. Image files can be embedded, and
|
|
37
|
-
other types of files can be attached as links. Additionally, website metadata is configured
|
|
38
|
-
via [JSON](http://json.org) files.
|
|
39
|
-
|
|
40
|
-
Overview
|
|
41
|
-
--------
|
|
42
|
-
|
|
43
|
-
DocGen transforms source files from an input directory into output files in an output directory.
|
|
44
|
-
|
|
45
|
-
It takes every source file (plain text) specified in **contents.json** and converts it. Each source file becomes a
|
|
46
|
-
separate page in the website and a separate chapter in the PDF.
|
|
47
|
-
|
|
48
|
-
DocGen adds metadata that is specified in **parameters.json**, and copies the images and files in the **files**
|
|
49
|
-
directory to the output.
|
|
50
|
-
|
|
51
|
-
> Always save input files with **UTF-8** encoding. This makes non-standard characters (ø © é etc) work.
|
|
52
|
-
|
|
53
|
-
Metadata
|
|
54
|
-
--------
|
|
55
|
-
|
|
56
|
-
**parameters.json**
|
|
57
|
-
|
|
58
|
-
The parameters file is used to specify metadata describing the product.
|
|
59
|
-
|
|
60
|
-
- **title** - the product title
|
|
61
|
-
- **name** - the product name (also used to name the PDF)
|
|
62
|
-
- **version** - the release version
|
|
63
|
-
- **date** - the release date
|
|
64
|
-
- **organization** - the company or organization
|
|
65
|
-
- **author** - the lead author of the document
|
|
66
|
-
- **owner** - the owner of the product
|
|
67
|
-
- **contributors** - list of contributors
|
|
68
|
-
- **website** - a link to the product website
|
|
69
|
-
- **backlink** - a link back to product user interface (useful for integrated documentation)
|
|
70
|
-
- **module** - module name (useful for larger products with submodules)
|
|
71
|
-
- **id** - reference number (e.g. product id in a change management tool)
|
|
72
|
-
- **summary** - a descriptive summary of the product
|
|
73
|
-
- **marking** - license or other protective markings
|
|
74
|
-
- **legalese** - document markings (confidentiality, disclaimers, smallprint etc)
|
|
75
|
-
|
|
76
|
-
Values can be empty strings, but the elements are required in the JSON file.
|
|
77
|
-
|
|
78
|
-
Parameters with URLs can be either website URLs, or email addresses (specify *'mailto:name@address.com'*).
|
|
79
|
-
|
|
80
|
-
**contents.json**
|
|
81
|
-
|
|
82
|
-
The contents file specifies the names, locations, order, and hierarchy of the source files. It is used to generate both
|
|
83
|
-
the web and PDF table of contents.
|
|
84
|
-
|
|
85
|
-
**release-notes.txt**
|
|
86
|
-
|
|
87
|
-
The release notes source file is a mandatory source file (that does not need to be listed in contents.json). Use it to
|
|
88
|
-
summarize the change history for each version of the product.
|
|
89
|
-
|
|
90
|
-
Plain text
|
|
91
|
-
----------
|
|
92
|
-
|
|
93
|
-
The simplest input format is just to write in plain text. Here is an example of the source and output:
|
|
94
|
-
|
|
95
|
-
<div class="container codeContainer">
|
|
96
|
-
|
|
97
|
-
Example paragraph.
|
|
98
|
-
|
|
99
|
-
</div>
|
|
100
|
-
<div class="container exampleContainer">
|
|
101
|
-
|
|
102
|
-
Example paragraph.
|
|
103
|
-
|
|
104
|
-
</div><br class="w-clear"/>
|
|
105
|
-
|
|
106
|
-
<p class="dg-forceBreak"></p>
|
|
107
|
-
|
|
108
|
-
CommonMark (Markdown)
|
|
109
|
-
---------------------
|
|
110
|
-
|
|
111
|
-
[CommonMark](http://commonmark.org/) (also known as [MarkDown](http://daringfireball.net/projects/markdown/)) is a
|
|
112
|
-
human-friendly plain text markup format. The source format is easy to read and write, and the CommonMark parser
|
|
113
|
-
translates it into HTML. DocGen uses the <a href="https://markdown-it.github.io">markdown-it</a> implementation
|
|
114
|
-
of CommonMark. Here is an example of the source and output:
|
|
115
|
-
|
|
116
|
-
<div class="container codeContainer">
|
|
117
|
-
|
|
118
|
-
CommonMark Example
|
|
119
|
-
------------------
|
|
120
|
-
|
|
121
|
-
Paragraphs are text blocks separated by new lines.
|
|
122
|
-
|
|
123
|
-
Text can be styled: *emphasised* and **strong**.
|
|
124
|
-
|
|
125
|
-
Here is an [example link](http://www.google.com).
|
|
126
|
-
|
|
127
|
-
# To make a code block, just indent with a tab
|
|
128
|
-
# "Hello World" in Ruby:
|
|
129
|
-
5.times { puts "Hello!" }
|
|
130
|
-
</div>
|
|
131
|
-
<div class="container exampleContainer">
|
|
132
|
-
|
|
133
|
-
<p class="dg-fakeHeading" style="font-size: 18px; padding-bottom: 4px;">CommonMark Example</p>
|
|
134
|
-
|
|
135
|
-
Paragraphs are text blocks separated by new lines.
|
|
136
|
-
|
|
137
|
-
Text can be styled: *emphasised* and **strong**.
|
|
138
|
-
|
|
139
|
-
Here is an [example link](http://www.google.com).
|
|
140
|
-
|
|
141
|
-
# To make a code block, just indent with a tab
|
|
142
|
-
# "Hello World" in Ruby:
|
|
143
|
-
5.times { puts "Hello!" }
|
|
144
|
-
</div><br class="w-clear"/>
|
|
145
|
-
|
|
146
|
-
For more examples, see the [CommonMark reference](commonmark.html).
|
|
147
|
-
|
|
148
|
-
HTML
|
|
149
|
-
----
|
|
150
|
-
|
|
151
|
-
For more complex pages not covered by CommonMark's syntax, simply use inline HTML:
|
|
152
|
-
|
|
153
|
-
<div class="container codeContainer">
|
|
154
|
-
<pre><code><table>
|
|
155
|
-
<tr>
|
|
156
|
-
<td>Foo</td>
|
|
157
|
-
<td>Bar</td>
|
|
158
|
-
<td>Baz</td>
|
|
159
|
-
</tr>
|
|
160
|
-
</table></code></pre>
|
|
161
|
-
</div>
|
|
162
|
-
<div class="container exampleContainer">
|
|
163
|
-
<table>
|
|
164
|
-
<tr>
|
|
165
|
-
<td>Foo</td>
|
|
166
|
-
<td>Bar</td>
|
|
167
|
-
<td>Baz</td>
|
|
168
|
-
</tr>
|
|
169
|
-
</table>
|
|
170
|
-
</div><br class="w-clear"/>
|
|
171
|
-
|
|
172
|
-
For more examples, see [writing advanced content](advanced-content.html).
|
|
173
|
-
|
|
174
|
-
> Inline HTML is still parsed by the CommonMark parser (HTML is allowed in CommonMark documents). In DocGen, it is also
|
|
175
|
-
possible to bypass the CommonMark parser altogether and specify a pure HTML input page, by setting
|
|
176
|
-
<code class="w-inline-code">"html": true</code> in a page object in *contents.json*.
|
|
177
|
-
|
|
178
|
-
Embedding images
|
|
179
|
-
----------------
|
|
180
|
-
|
|
181
|
-
Diagrams (in image form, e.g. JPEG, PNG, GIF etc) should be put the *files/images* directory, and embedded as images.
|
|
182
|
-
|
|
183
|
-
<div class="container codeContainer">
|
|
184
|
-
<pre><code></code></pre>
|
|
185
|
-
</div>
|
|
186
|
-
<div class="container exampleContainer">
|
|
187
|
-
<img src="files/images/logo.png" />
|
|
188
|
-
</div><br class="w-clear"/>
|
|
189
|
-
|
|
190
|
-
Attaching files
|
|
191
|
-
---------------
|
|
192
|
-
|
|
193
|
-
Other files you want to attach should go into *files* directory.
|
|
194
|
-
|
|
195
|
-
<div class="container codeContainer">
|
|
196
|
-
<pre><code>[attachment](user_guide.pdf)</code></pre>
|
|
197
|
-
</div>
|
|
198
|
-
<div class="container exampleContainer">
|
|
199
|
-
<a href="user_guide.pdf">attachment</a>
|
|
200
|
-
</div><br class="w-clear"/>
|
|
201
|
-
|
|
202
|
-
Mathematical Expressions
|
|
203
|
-
------------------------
|
|
204
|
-
|
|
205
|
-
[LaTeX](http://en.wikipedia.org/wiki/LaTeX) is the most common markup format for mathematical expressions.
|
|
206
|
-
|
|
207
|
-
Modern web browsers do not yet consistently support a common standard for authoring mathematical expressions. For this
|
|
208
|
-
reason, extra libraries are needed. DocGen supports two widely-used web mathematics libraries out-the-box:
|
|
209
|
-
|
|
210
|
-
- **[KaTeX](http://khan.github.io/KaTeX/)** is fast, lightweight, and [supports fewer features](http://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)
|
|
211
|
-
- **[MathJax](https://www.mathjax.org/)** is slower, larger, and [supports more features](http://docs.mathjax.org/en/latest/tex.html#supported-latex-commands)
|
|
212
|
-
|
|
213
|
-
The document author decides which one (or both) to use.
|
|
214
|
-
|
|
215
|
-
<p class="dg-forceBreak"></p>
|
|
216
|
-
|
|
217
|
-
### Mathematics using KaTeX
|
|
218
|
-
|
|
219
|
-
KaTeX is the recommended choice. It is bundled with DocGen but must be enabled by passing the
|
|
220
|
-
**-m** option.
|
|
221
|
-
|
|
222
|
-
<div class="container codeContainer">
|
|
223
|
-
<pre><code><div class="dg-katexMath">
|
|
224
|
-
f(x) = \int_{-\infty}^\infty
|
|
225
|
-
\hat f(\xi)\,e^{2 \pi i \xi x}
|
|
226
|
-
\,d\xi
|
|
227
|
-
</div></code></pre>
|
|
228
|
-
</div>
|
|
229
|
-
<div class="container exampleContainer">
|
|
230
|
-
<div class="dg-katexMath">
|
|
231
|
-
f(x) = \int_{-\infty}^\infty
|
|
232
|
-
\hat f(\xi)\,e^{2 \pi i \xi x}
|
|
233
|
-
\,d\xi
|
|
234
|
-
</div>
|
|
235
|
-
</div><br class="w-clear"/>
|
|
236
|
-
|
|
237
|
-
### Mathematics using MathJax
|
|
238
|
-
|
|
239
|
-
MathJax is the fallback choice for expressions not yet supported by KaTex. When required, MathJax can be enabled by
|
|
240
|
-
passing the **-n** option.
|
|
241
|
-
|
|
242
|
-
> DocGen uses the same MathJax configuration as the popular [Stack Exchange](http://math.stackexchange.com) websites.
|
|
243
|
-
|
|
244
|
-
<p class="w-error">
|
|
245
|
-
Because MathJax is a large library, it is not bundled with DocGen, but is served from a third-party CDN
|
|
246
|
-
(content delivery network). This means users need an active Internet connection for the MathJax feature to work.
|
|
247
|
-
</p>
|
|
248
|
-
|
|
249
|
-
<p class="w-error">
|
|
250
|
-
MathJax can be slow to render. When used with the PDF feature, it may be necessary to allow more rendering time by
|
|
251
|
-
passing the <br/><strong>-d [milliseconds]</strong> option.
|
|
252
|
-
</p>
|
|
253
|
-
|
|
254
|
-
<div class="container codeContainer">
|
|
255
|
-
<pre><code>$$
|
|
256
|
-
f(n) = \begin{cases}
|
|
257
|
-
n/2, & \text{if $n$ is even} \\
|
|
258
|
-
3n+1, & \text{if $n$ is odd}
|
|
259
|
-
\end{cases}
|
|
260
|
-
$$</code></pre>
|
|
261
|
-
</div>
|
|
262
|
-
<div class="container exampleContainer">
|
|
263
|
-
$$
|
|
264
|
-
f(n) = \begin{cases}
|
|
265
|
-
n/2, & \text{if $n$ is even} \\
|
|
266
|
-
3n+1, & \text{if $n$ is odd}
|
|
267
|
-
\end{cases}
|
|
268
|
-
$$
|
|
269
|
-
</div><br class="w-clear"/>
|
|
1
|
+
<style>
|
|
2
|
+
.container {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
float:left;
|
|
5
|
+
width: 480px;
|
|
6
|
+
}
|
|
7
|
+
.codeContainer {
|
|
8
|
+
margin: 0 20px 0 0;
|
|
9
|
+
}
|
|
10
|
+
.codeContainer pre {
|
|
11
|
+
margin: 0;
|
|
12
|
+
}
|
|
13
|
+
.codeContainer code {
|
|
14
|
+
}
|
|
15
|
+
.codeContainer p {
|
|
16
|
+
margin: 0;
|
|
17
|
+
padding: 0;
|
|
18
|
+
}
|
|
19
|
+
.exampleContainer {
|
|
20
|
+
margin: 0;
|
|
21
|
+
border: 1px solid #666;
|
|
22
|
+
border-radius: 6px;
|
|
23
|
+
padding: 0 18px 0 18px;
|
|
24
|
+
}
|
|
25
|
+
.exampleContainer img {
|
|
26
|
+
margin-top: 5px;
|
|
27
|
+
}
|
|
28
|
+
#content table {
|
|
29
|
+
width: 400px!important;
|
|
30
|
+
}
|
|
31
|
+
.hljs-change {
|
|
32
|
+
background-color: transparent!important;
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
35
|
+
|
|
36
|
+
Content for a DocGen website is authored in plain text, using any text editor. Image files can be embedded, and
|
|
37
|
+
other types of files can be attached as links. Additionally, website metadata is configured
|
|
38
|
+
via [JSON](http://json.org) files.
|
|
39
|
+
|
|
40
|
+
Overview
|
|
41
|
+
--------
|
|
42
|
+
|
|
43
|
+
DocGen transforms source files from an input directory into output files in an output directory.
|
|
44
|
+
|
|
45
|
+
It takes every source file (plain text) specified in **contents.json** and converts it. Each source file becomes a
|
|
46
|
+
separate page in the website and a separate chapter in the PDF.
|
|
47
|
+
|
|
48
|
+
DocGen adds metadata that is specified in **parameters.json**, and copies the images and files in the **files**
|
|
49
|
+
directory to the output.
|
|
50
|
+
|
|
51
|
+
> Always save input files with **UTF-8** encoding. This makes non-standard characters (ø © é etc) work.
|
|
52
|
+
|
|
53
|
+
Metadata
|
|
54
|
+
--------
|
|
55
|
+
|
|
56
|
+
**parameters.json**
|
|
57
|
+
|
|
58
|
+
The parameters file is used to specify metadata describing the product.
|
|
59
|
+
|
|
60
|
+
- **title** - the product title
|
|
61
|
+
- **name** - the product name (also used to name the PDF)
|
|
62
|
+
- **version** - the release version
|
|
63
|
+
- **date** - the release date
|
|
64
|
+
- **organization** - the company or organization
|
|
65
|
+
- **author** - the lead author of the document
|
|
66
|
+
- **owner** - the owner of the product
|
|
67
|
+
- **contributors** - list of contributors
|
|
68
|
+
- **website** - a link to the product website
|
|
69
|
+
- **backlink** - a link back to product user interface (useful for integrated documentation)
|
|
70
|
+
- **module** - module name (useful for larger products with submodules)
|
|
71
|
+
- **id** - reference number (e.g. product id in a change management tool)
|
|
72
|
+
- **summary** - a descriptive summary of the product
|
|
73
|
+
- **marking** - license or other protective markings
|
|
74
|
+
- **legalese** - document markings (confidentiality, disclaimers, smallprint etc)
|
|
75
|
+
|
|
76
|
+
Values can be empty strings, but the elements are required in the JSON file.
|
|
77
|
+
|
|
78
|
+
Parameters with URLs can be either website URLs, or email addresses (specify *'mailto:name@address.com'*).
|
|
79
|
+
|
|
80
|
+
**contents.json**
|
|
81
|
+
|
|
82
|
+
The contents file specifies the names, locations, order, and hierarchy of the source files. It is used to generate both
|
|
83
|
+
the web and PDF table of contents.
|
|
84
|
+
|
|
85
|
+
**release-notes.txt**
|
|
86
|
+
|
|
87
|
+
The release notes source file is a mandatory source file (that does not need to be listed in contents.json). Use it to
|
|
88
|
+
summarize the change history for each version of the product.
|
|
89
|
+
|
|
90
|
+
Plain text
|
|
91
|
+
----------
|
|
92
|
+
|
|
93
|
+
The simplest input format is just to write in plain text. Here is an example of the source and output:
|
|
94
|
+
|
|
95
|
+
<div class="container codeContainer">
|
|
96
|
+
|
|
97
|
+
Example paragraph.
|
|
98
|
+
|
|
99
|
+
</div>
|
|
100
|
+
<div class="container exampleContainer">
|
|
101
|
+
|
|
102
|
+
Example paragraph.
|
|
103
|
+
|
|
104
|
+
</div><br class="w-clear"/>
|
|
105
|
+
|
|
106
|
+
<p class="dg-forceBreak"></p>
|
|
107
|
+
|
|
108
|
+
CommonMark (Markdown)
|
|
109
|
+
---------------------
|
|
110
|
+
|
|
111
|
+
[CommonMark](http://commonmark.org/) (also known as [MarkDown](http://daringfireball.net/projects/markdown/)) is a
|
|
112
|
+
human-friendly plain text markup format. The source format is easy to read and write, and the CommonMark parser
|
|
113
|
+
translates it into HTML. DocGen uses the <a href="https://markdown-it.github.io">markdown-it</a> implementation
|
|
114
|
+
of CommonMark. Here is an example of the source and output:
|
|
115
|
+
|
|
116
|
+
<div class="container codeContainer">
|
|
117
|
+
|
|
118
|
+
CommonMark Example
|
|
119
|
+
------------------
|
|
120
|
+
|
|
121
|
+
Paragraphs are text blocks separated by new lines.
|
|
122
|
+
|
|
123
|
+
Text can be styled: *emphasised* and **strong**.
|
|
124
|
+
|
|
125
|
+
Here is an [example link](http://www.google.com).
|
|
126
|
+
|
|
127
|
+
# To make a code block, just indent with a tab
|
|
128
|
+
# "Hello World" in Ruby:
|
|
129
|
+
5.times { puts "Hello!" }
|
|
130
|
+
</div>
|
|
131
|
+
<div class="container exampleContainer">
|
|
132
|
+
|
|
133
|
+
<p class="dg-fakeHeading" style="font-size: 18px; padding-bottom: 4px;">CommonMark Example</p>
|
|
134
|
+
|
|
135
|
+
Paragraphs are text blocks separated by new lines.
|
|
136
|
+
|
|
137
|
+
Text can be styled: *emphasised* and **strong**.
|
|
138
|
+
|
|
139
|
+
Here is an [example link](http://www.google.com).
|
|
140
|
+
|
|
141
|
+
# To make a code block, just indent with a tab
|
|
142
|
+
# "Hello World" in Ruby:
|
|
143
|
+
5.times { puts "Hello!" }
|
|
144
|
+
</div><br class="w-clear"/>
|
|
145
|
+
|
|
146
|
+
For more examples, see the [CommonMark reference](commonmark.html).
|
|
147
|
+
|
|
148
|
+
HTML
|
|
149
|
+
----
|
|
150
|
+
|
|
151
|
+
For more complex pages not covered by CommonMark's syntax, simply use inline HTML:
|
|
152
|
+
|
|
153
|
+
<div class="container codeContainer">
|
|
154
|
+
<pre><code><table>
|
|
155
|
+
<tr>
|
|
156
|
+
<td>Foo</td>
|
|
157
|
+
<td>Bar</td>
|
|
158
|
+
<td>Baz</td>
|
|
159
|
+
</tr>
|
|
160
|
+
</table></code></pre>
|
|
161
|
+
</div>
|
|
162
|
+
<div class="container exampleContainer">
|
|
163
|
+
<table>
|
|
164
|
+
<tr>
|
|
165
|
+
<td>Foo</td>
|
|
166
|
+
<td>Bar</td>
|
|
167
|
+
<td>Baz</td>
|
|
168
|
+
</tr>
|
|
169
|
+
</table>
|
|
170
|
+
</div><br class="w-clear"/>
|
|
171
|
+
|
|
172
|
+
For more examples, see [writing advanced content](advanced-content.html).
|
|
173
|
+
|
|
174
|
+
> Inline HTML is still parsed by the CommonMark parser (HTML is allowed in CommonMark documents). In DocGen, it is also
|
|
175
|
+
possible to bypass the CommonMark parser altogether and specify a pure HTML input page, by setting
|
|
176
|
+
<code class="w-inline-code">"html": true</code> in a page object in *contents.json*.
|
|
177
|
+
|
|
178
|
+
Embedding images
|
|
179
|
+
----------------
|
|
180
|
+
|
|
181
|
+
Diagrams (in image form, e.g. JPEG, PNG, GIF etc) should be put the *files/images* directory, and embedded as images.
|
|
182
|
+
|
|
183
|
+
<div class="container codeContainer">
|
|
184
|
+
<pre><code></code></pre>
|
|
185
|
+
</div>
|
|
186
|
+
<div class="container exampleContainer">
|
|
187
|
+
<img src="files/images/logo.png" />
|
|
188
|
+
</div><br class="w-clear"/>
|
|
189
|
+
|
|
190
|
+
Attaching files
|
|
191
|
+
---------------
|
|
192
|
+
|
|
193
|
+
Other files you want to attach should go into *files* directory.
|
|
194
|
+
|
|
195
|
+
<div class="container codeContainer">
|
|
196
|
+
<pre><code>[attachment](user_guide.pdf)</code></pre>
|
|
197
|
+
</div>
|
|
198
|
+
<div class="container exampleContainer">
|
|
199
|
+
<a href="user_guide.pdf">attachment</a>
|
|
200
|
+
</div><br class="w-clear"/>
|
|
201
|
+
|
|
202
|
+
Mathematical Expressions
|
|
203
|
+
------------------------
|
|
204
|
+
|
|
205
|
+
[LaTeX](http://en.wikipedia.org/wiki/LaTeX) is the most common markup format for mathematical expressions.
|
|
206
|
+
|
|
207
|
+
Modern web browsers do not yet consistently support a common standard for authoring mathematical expressions. For this
|
|
208
|
+
reason, extra libraries are needed. DocGen supports two widely-used web mathematics libraries out-the-box:
|
|
209
|
+
|
|
210
|
+
- **[KaTeX](http://khan.github.io/KaTeX/)** is fast, lightweight, and [supports fewer features](http://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)
|
|
211
|
+
- **[MathJax](https://www.mathjax.org/)** is slower, larger, and [supports more features](http://docs.mathjax.org/en/latest/tex.html#supported-latex-commands)
|
|
212
|
+
|
|
213
|
+
The document author decides which one (or both) to use.
|
|
214
|
+
|
|
215
|
+
<p class="dg-forceBreak"></p>
|
|
216
|
+
|
|
217
|
+
### Mathematics using KaTeX
|
|
218
|
+
|
|
219
|
+
KaTeX is the recommended choice. It is bundled with DocGen but must be enabled by passing the
|
|
220
|
+
**-m** option.
|
|
221
|
+
|
|
222
|
+
<div class="container codeContainer">
|
|
223
|
+
<pre><code><div class="dg-katexMath">
|
|
224
|
+
f(x) = \int_{-\infty}^\infty
|
|
225
|
+
\hat f(\xi)\,e^{2 \pi i \xi x}
|
|
226
|
+
\,d\xi
|
|
227
|
+
</div></code></pre>
|
|
228
|
+
</div>
|
|
229
|
+
<div class="container exampleContainer">
|
|
230
|
+
<div class="dg-katexMath">
|
|
231
|
+
f(x) = \int_{-\infty}^\infty
|
|
232
|
+
\hat f(\xi)\,e^{2 \pi i \xi x}
|
|
233
|
+
\,d\xi
|
|
234
|
+
</div>
|
|
235
|
+
</div><br class="w-clear"/>
|
|
236
|
+
|
|
237
|
+
### Mathematics using MathJax
|
|
238
|
+
|
|
239
|
+
MathJax is the fallback choice for expressions not yet supported by KaTex. When required, MathJax can be enabled by
|
|
240
|
+
passing the **-n** option.
|
|
241
|
+
|
|
242
|
+
> DocGen uses the same MathJax configuration as the popular [Stack Exchange](http://math.stackexchange.com) websites.
|
|
243
|
+
|
|
244
|
+
<p class="w-error">
|
|
245
|
+
Because MathJax is a large library, it is not bundled with DocGen, but is served from a third-party CDN
|
|
246
|
+
(content delivery network). This means users need an active Internet connection for the MathJax feature to work.
|
|
247
|
+
</p>
|
|
248
|
+
|
|
249
|
+
<p class="w-error">
|
|
250
|
+
MathJax can be slow to render. When used with the PDF feature, it may be necessary to allow more rendering time by
|
|
251
|
+
passing the <br/><strong>-d [milliseconds]</strong> option.
|
|
252
|
+
</p>
|
|
253
|
+
|
|
254
|
+
<div class="container codeContainer">
|
|
255
|
+
<pre><code>$$
|
|
256
|
+
f(n) = \begin{cases}
|
|
257
|
+
n/2, & \text{if $n$ is even} \\
|
|
258
|
+
3n+1, & \text{if $n$ is odd}
|
|
259
|
+
\end{cases}
|
|
260
|
+
$$</code></pre>
|
|
261
|
+
</div>
|
|
262
|
+
<div class="container exampleContainer">
|
|
263
|
+
$$
|
|
264
|
+
f(n) = \begin{cases}
|
|
265
|
+
n/2, & \text{if $n$ is even} \\
|
|
266
|
+
3n+1, & \text{if $n$ is odd}
|
|
267
|
+
\end{cases}
|
|
268
|
+
$$
|
|
269
|
+
</div><br class="w-clear"/>
|
package/tsconfig.json
ADDED
package/.npmignore
DELETED