You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/ocamldoc_differences.mld
+2-1
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ can be seen rendered by [odoc] {{!Odoc_examples.Markup.Foo}here}.
13
13
The following describes the changes between what [odoc] understands and what’s in the OCaml manual.
14
14
15
15
- Heading levels are more restrictive. In the manual, it suggests any whole number is acceptable. In [odoc],
16
-
we follow the HTML spec in allowing headings from 1-6, and we also allow heading level [0] for the title
16
+
similarly to the HTML spec, we allow headings from 1-5, and heading level [0] for the title
17
17
of [.mld] files. [odoc] emits a warning for heading levels outside this range and caps them.
18
18
19
19
{3 Omissions}
@@ -29,6 +29,7 @@ The following describes the changes between what [odoc] understands and what’s
29
29
An other difference is that documentation starting with a heading or something that is not a paragraph won't have a synopsis ({{:https://github.com/ocaml/odoc/pull/643}github issue}).
30
30
31
31
{3 Improvements}
32
+
- [odoc] supports writing mathematics and tables with a specific syntax.
32
33
- [odoc] has a better mechanism for disambiguating references in comments. See 'reference syntax' later in this document.
33
34
- Built-in support for standalone [.mld] files. These are documents using the OCamldoc markup, but they’re rendered as distinct pages.
34
35
- Structured output: [odoc] can produce output in a structured directory tree rather a set of files.
Copy file name to clipboardExpand all lines: doc/odoc_for_authors.mld
+68
Original file line number
Diff line number
Diff line change
@@ -542,6 +542,74 @@ in block form this becomes:
542
542
See the {{:https://katex.org/docs/supported.html}KaTeX documentation} for the
543
543
HTML mode LaTeX support status.
544
544
545
+
{2 Tables}
546
+
547
+
Odoc 2.3 introduced new markup for tables. This markup comes in two flavors: the light syntax, and the heavy syntax.
548
+
549
+
The heavy syntax uses several markup: [{table ...}] to define a table, [{tr ...}] to define a row, and [{th ...}] and [{td ...}] to respectively define a header cell and a data cell.
550
+
Direct children of tables have to be rows, and direct children of rows have to be cells. Similarly, rows have to be direct children of tables, and cells direct children of row. Cells can contain any markup.
551
+
552
+
For instance, the following table:
553
+
554
+
{[
555
+
{table
556
+
{tr
557
+
{th Header 1}
558
+
{th Header 2}
559
+
{th Header 3}
560
+
}
561
+
{tr
562
+
{td Cell 1}
563
+
{td Cell with {e emphasized content}}
564
+
{td {v a block v} }
565
+
}
566
+
}
567
+
]}
568
+
569
+
would render as
570
+
571
+
{table
572
+
{tr
573
+
{th Header 1}
574
+
{th Header 2}
575
+
{th Header 3}
576
+
}
577
+
{tr
578
+
{td Cell 1}
579
+
{td Cell with {e emphasized content}}
580
+
{td {v a block v} }
581
+
}
582
+
}
583
+
584
+
585
+
The light syntax has the advantages of being simple to read, even as plain text. It is very similar to the {{:https://github.github.com/gfm/#tables-extension-}GFM Markdown syntax}, with the exception that it has to be enclosed in [{t ...}], and that the inline markup is the ocamldoc one. It supports alignment for columns using the [:] notation, from the GFM syntax: [---] is the default alignment, [:--] left-aligned, [--:] right-aligned and [:---:] is centered.
586
+
587
+
The following table, in light syntax:
588
+
589
+
{[
590
+
{t
591
+
| Header 1 | Header 2 | Header 3 | Header 4|
592
+
| :------: | --------:|:---------|---------|
593
+
| centered | right | left | default |
594
+
omitted | bar at | start and| finish
595
+
| {e emph} | and | unaligned | bars |
596
+
}
597
+
]}
598
+
599
+
would render as
600
+
601
+
{t
602
+
| Header 1 | Header 2 | Header 3 | Header 4|
603
+
| :------: | --------:|:---------|---------|
604
+
| centered | right | left | default |
605
+
omitted | bar at | start and| finish
606
+
| {e emph} | and | unaligned | bars |
607
+
}
608
+
609
+
The light syntax has the advantages of being arguably more readable for small tables, when viewing the source file directly. However, its content is restricted (for instance, no new line is allowed).
610
+
The heavy syntax is easier to write, can be more readable for big tables, and supports having any kind of content inside. It does not support alignment (yet).
0 commit comments