OILS / doc / doc-toolchain.md View on Github | oilshell.org

120 lines, 72 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
64Here's an example of how it works. This Markdown:
65
66 The [GNU bash shell]($xref:bash)
67
68is translated to HTML by [CommonMark][]:
69
70 The <a href="$xref:bash">GNU bash shell</a>
71
72Our `$xref:` plugin expands it to:
73
74 The <a href="/cross-ref.html#bash">GNU bash shell</a>
75
76If the argument is omitted, then the **anchor text** is used. So you can just write:
77
78 [bash][]
79
80and it will become:
81
82 The <a href="/cross-ref.html#bash">bash</a>
83
84List of plugins:
85
86- `$xref:bash` expands to `/cross-ref.html#bash` (shown above)
87- `$blog-tag:oil-release` expands to `/blog/tags.html#oil-release`
88- `$oils-src`
89
90See the raw and rendered versions of this doc for more:
91
92- [doc-plugins.md][]
93- [doc-plugins.html](doc-plugins.html)
94
95[doc-plugins.md]: $oils-src:doc/doc-plugins.md
96
97### Syntax Highlighting of Code Blocks
98
99Use Markdown's fenced code blocks like this:
100
101 ``` sh-prompt
102 ysh$ var x = 'hello world'
103 ysh$ echo $x
104 hello world
105 ```
106
107Or you can set `default_highlighter` for blocks indented by 4 spaces.
108
109Again see [doc-plugins.md][] for examples.
110
111## The Help Toolchain Renders to HTML and ANSI
112
113This is done with `doctools/`
114
115## Code Location
116
117- [build/doc.sh]($oils-src) drives the tools in [doctools/]($oils-src).
118- Markdown files are in [doc/]($oils-src).
119
120