OILS / doc / doc-toolchain.md View on Github | oils.pub

139 lines, 85 significant
1---
2in_progress: yes
3---
4
5How We Build Oils Documentation
6================================
7
81. Write Markdown by hand, with optional "front matter".
92. Render Markdown to HTML, and run the result through our own HTML filters.
103. Publish static HTML to <https://www.oilshell.org/>.
11
12The code is in the [doctools/]($oils-src) directory, which uses the
13[lazylex/]($oils-src) library.
14
15<div id="toc">
16</div>
17
18## Quick Start
19
20To build and preview this doc, run:
21
22 build/doc.sh split-and-render doc/doc-toolchain.md
23
24Open the path in prints in your browser
25(`_release/VERSION/doc/doc-toolchain.html`).
26
27## Front Matter and Title
28
29Most docs start with something like this:
30
31 ---
32 in_progress: yes
33 default_highlighter: oils-sh
34 ---
35
36 My Title
37 ========
38
39 Hello
40
41The "front matter" between `---` lines is metadata for rendering the doc.
42Github's web UI understands and renders it.
43
44## Plugins That Transform HTML
45
46We have some HTML plugins that make writing **markdown** easier.
47Note that [CommonMark][] tightens up the rules for embedding HTML in Markdown,
48and that is very useful.
49
50[CommonMark]: https://www.oilshell.org/blog/2018/02/14.html
51
52### Table of Contents
53
54Insert this into the doc
55
56 <div id="toc">
57 </div>
58
59and it will be expanded into a table of contents derived from `h2` and `h3`
60tags.
61
62### Link Shortcuts, e.g. `$xref`
63
64Markdown:
65
66 The [GNU bash shell]($xref:bash)
67
68After [CommonMark][]:
69
70 The <a href="$xref:bash">GNU bash shell</a>
71
72After our `$xref:` plugin:
73
74 The <a href="/cross-ref.html#bash">GNU bash shell</a>
75
76Example: The [GNU bash shell]($xref:bash)
77
78---
79
80If the argument is omitted, then the **anchor text** is used. So you can just write:
81
82 [bash][]
83
84and it will become:
85
86 The <a href="/cross-ref.html#bash">bash</a>
87
88Example: [bash][]
89
90[bash]: $xref
91
92List of plugins:
93
94- `$xref:bash` expands to `/cross-ref.html#bash` (shown above)
95- `$blog-tag:oil-release` expands to `/blog/tags.html#oil-release`
96- `$oils-src`
97
98See the raw and rendered versions of this doc for more:
99
100- [doc-plugins.md][]
101- [doc-plugins.html](doc-plugins.html)
102
103[doc-plugins.md]: $oils-src:doc/doc-plugins.md
104
105### Syntax Highlighting of Code Blocks
106
107Use Markdown's fenced code blocks like this:
108
109 ```oil-sh
110 ysh$ var x = 'hello world'
111 ysh$ echo $x
112 hello world
113 ```
114
115Example:
116
117```oil-sh
118ysh$ var x = 'hello world'
119ysh$ echo $x
120hello world
121```
122
123
124Or you can set `default_highlighter` for blocks indented by 4 spaces.
125
126Again see [doc-plugins.md][] for examples.
127
128## Convenient Tables with `ul-table`
129
130See this doc: [ul-table: Markdown Tables Without New Syntax](ul-table.html)
131## Code Location
132
133- [build/doc.sh]($oils-src) drives the tools in [doctools/]($oils-src).
134- Markdown files are in [doc/]($oils-src).
135
136## Related
137
138- [Examples of HTML Plugins](doc-plugins.html)
139- [ul-table: Markdown Tables Without New Syntax](ul-table.html)