OILS / doc / ul-table-compare.md View on Github | oils.pub

153 lines, 100 significant
1---
2in_progress: yes
3---
4
5ul-table Comparison
6====================
7
8TODO: This may go on the blog.
9
10Main doc: [ul-table: Markdown Tables Without New Syntax](ul-table.html)
11
12<div id="toc">
13</div>
14
15## Markdown-Based
16
17### ul-table
18
19### Plain Markdown
20
21- You can't write inline HTML
22
23### CommonMark
24
25Tedious Inline HTML!
26
27Here's the equivalent in CommonMark:
28
29 <table>
30 <thead>
31 <tr>
32 <td>Shell</td>
33 <td>Version</td>
34 </tr>
35 </thead>
36 <tr>
37 <td>
38
39 <!-- be careful not to indent this 4 spaces! -->
40 [bash](https://www.gnu.org/software/bash/)
41
42 </td>
43 <td>5.2</td>
44 </tr>
45 <tr>
46 <td>
47
48 [OSH](https://oils.pub/)
49
50 </td>
51 <td>0.25.0</td>
52 </tr>
53
54 </table>
55
56It uses the rule where you can embed Markdown inside HTML inside Markdown.
57With `ul-table`, you **don't** need this mutual nesting.
58
59The `ul-table` text is also shorter!
60
61---
62
63Trivia: with CommonMark, you get an extra `<p>` element:
64
65 <td>
66 <p>OSH</p>
67 </td>
68
69`ul-table` can produce simpler HTML:
70
71 <td>
72 OSH
73 </td>
74
75- Inline HTML
76
77CommonMark Doesn't Have Tables. Related discussions:
78
79- 2014: [Tables in pure Markdown](https://talk.commonmark.org/t/tables-in-pure-markdown/81)
80- 2022: [Obvious Markdown syntax for Tables](https://talk.commonmark.org/t/obvious-markdown-syntax-for-tables/4143/9)
81
82
83### Github-Flavored Markdown
84
85Github Tables are Awkward.
86
87Github-flavored Markdown has an non-standard extension for tables:
88
89- [Github: Organizing Information With Tables](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables)
90
91This style is hard to read and write, especially with large tables:
92
93```
94| Command | Description |
95| --- | --- |
96| git status | List all new or modified files |
97| git diff | Show file differences that haven't been staged |
98```
99
100Our style is less noisy, and more easily editable:
101
102```
103<table>
104
105- thead
106 - Command
107 - Description
108- tr
109 - git status
110 - List all new or modified files
111- tr
112 - git diff
113 - Show file differences that haven't been staged
114
115</table>
116```
117
118- Related wiki page: [Markdown Tables]($wiki)
119
120
121
122## Non-Markdown
123
124### reStructuredText
125
126ul-table looks similar to [tables in
127reStructuredText](https://sublime-and-sphinx-guide.readthedocs.io/en/latest/tables.html).
128
129### AsciiDoc
130
131TODO
132
133### MediaWiki (Wikipedia)
134
135Here is a **long** page describing how to make tables on Wikipedia:
136
137- <https://en.wikipedia.org/wiki/Help:Table>
138
139I created the equivalent of the opening example:
140
141```
142{| class="wikitable"
143! Shell !! Version
144|-
145| [https://www.gnu.org/software/bash/ Bash] || 5.2
146|-
147| [https://www.oilshell.org/ OSH] || 0.25.0
148|}
149```
150
151In general, it has more "ASCII art", and invents a lot of new syntax.
152
153I prefer `ul-table` because it reuses Markdown and HTML syntax.