Skip to content

Commit

Permalink
docs(manual): Migrate Markdown chapters to Djot
Browse files Browse the repository at this point in the history
We've already a lot of Djot chapters.
It parses faster and has more capabilities, so generalize it.
  • Loading branch information
Omikhleia authored and Didier Willis committed Jan 18, 2025
1 parent aa0537a commit d225c73
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 50 deletions.
5 changes: 4 additions & 1 deletion examples/manual-front.sil
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
\set[parameter=document.parindent, value=0]{%
\roughbox[enlarge=true, singlestroke=true, preserve=true,
padding=2%fw, bordercolor=#59b24c, fillcolor=230, shadowcolor=#96A8C7, shadow=false]{%
\parbox[width=96%lw]{\set[parameter=document.parindent, value=0]\font[size=9pt]\color[color=100]{\process}\par}%
% Beware, wrap color around the parbox so it stays in horizontal mode
% In the parbox it could lead to a blank line (we'd need to fix this...)
% Colors aren't settings so they propagate to the parbox, whatever settings logic it has.
\color[color=100]{\parbox[width=96%lw]{\set[parameter=document.parindent, value=0]\font[size=9pt]{\process}\par}}%
}}%
\medskip}

Expand Down
2 changes: 1 addition & 1 deletion examples/manual-masterdoc/bibliographies.dj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Refer to _The SILE Book_ for more information on how to do this.

## Printing the bibliography

The **resilient.book** class registers a Djot symbol, `_BIBLIOGRAPHY_`, which you can use in a standalone paragraph to print the bibliography.[^bibliography-symbol]
The *resilient.book* class registers a Djot symbol, `_BIBLIOGRAPHY_`, which you can use in a standalone paragraph to print the bibliography.[^bibliography-symbol]
Attributes are passed through to the underlying implementation.
For example, to print all the bibliography including uncited references, you can use:

Expand Down
2 changes: 1 addition & 1 deletion examples/manual-masterdoc/masterdoc.dj
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ chapters:
```

We earlier mentioned the `parts` keywords.
With document classes supporting parts, such as **resilient.book**, it allows using them, starting at that level.[^masterdoc-astute]
With document classes supporting parts, such as *resilient.book*, it allows using them, starting at that level.[^masterdoc-astute]

[^masterdoc-nesting]: In particular, you may include a master document in another.
In that case, though, only the declared extra packages and the content files are used.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Styling initial capitals

Initial capitals (also known as drop caps) are a typographic feature where the first letter of a paragraph is enlarged and styled differently from the rest of the text.
The **resilient.book** class defines two commands for this purpose: `initial-joined` and `initial-unjoined`.
The *resilient.book* class defines two commands for this purpose: `initial-joined` and `initial-unjoined`.
The former should be used when the initial capital is part of the first word of the paragraph, and the latter when it is a separate character.

In Markdown or Djot, you may use one or the other directly as a style (although they are rather pseudo-styles, strictly speaking).
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Styling page numbers

In two-side documents, such as the **resilient.book** class, dedicated paragraph styles
In two-side documents, such as the *resilient.book* class, dedicated paragraph styles
are used for odd and even pages.
The _default_ definitions just take care the alignment, and defer other
styling decisions to a common parent style.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Styling lists

The **resilient.lists** package, as noted in its documentation, uses
The *resilient.lists* package, as noted in its documentation, uses
different sets of styles for the `itemize` and the `enumerate`
environments.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ You should therefore read their documentation to learn about them, and look at a

Readers experienced with SILE’s standard packages also have to be aware that the latter sometimes define hooks, initially intended for users to possibly re-implement in order to override some internal formatting logic. Obviously, in the context of a resilient-compatible class, some of these are already overriden to rely on the styling paradigm presented here.

For instance, the (standard) **url** package provides a `urlstyle` hook command. While you could override it---that is, redefine that command---, please note that this is what the resilient classes already do, so as to delegate the decision to a style conveniently called `urlstyle` too.[^other-sile-hooks]
For instance, the (standard) *url* package provides a `urlstyle` hook command. While you could override it---that is, redefine that command---, please note that this is what the resilient classes already do, so as to delegate the decision to a style conveniently called `urlstyle` too.[^other-sile-hooks]

[^other-sile-hooks]: The same principle actually applies to page numbers, relying on the standard **folio** package. The latter provides a `foliostyle` hook, which the resilient styling system overrides with its own clever logic.
Likewise, the `math:numberstyle` hook from the **math** package is also redefined, to rely on the `eqno` style for display math equation numbers (and actually, if it exist and is non-emppty, to the `eqno-⟨counter⟩` style specific to the counter in question, by default `equation`), as described in the previous section.
[^other-sile-hooks]: The same principle actually applies to page numbers, relying on the standard *folio* package. The latter provides a `foliostyle` hook, which the resilient styling system overrides with its own clever logic.
Likewise, the `math:numberstyle` hook from the *math* package is also redefined, to rely on the `eqno` style for display math equation numbers (and actually, if it exist and is non-emppty, to the `eqno-⟨counter⟩` style specific to the counter in question, by default `equation`), as described in the previous section.

In other terms, even for standard SILE packages, we may already have provided a style-aware version of their original customization hooks.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ consider:
- How page references are formatted.

[^toc-fancy]: This section applies to the "standard" table of contents,
as produced with the `\tableofcontents` command from the **resilient.tableofcontents**
as produced with the `\tableofcontents` command from the *resilient.tableofcontents*
package.
Specific implementations such as **fancytoc** may use their own
Specific implementations such as *fancytoc* may use their own
styling rules.

### Global setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ A regular character style obeys to the following specification
The ⟨font specification⟩ is an object which can contain any of the usual elements, as
used in the SILE `\font` command.

The ⟨color specification⟩ follows the same syntax as defined in the SILE **color** package.
The ⟨color specification⟩ follows the same syntax as defined in the SILE *color* package.

As an example, the following style results in a blue italic superscript in the Libertinus
Serif font.
Expand All @@ -35,12 +35,14 @@ my-custom-style-name:
position: "super"
```

#### Properties {.unnumbered}
{.unnumbered}
#### Properties

The "properties" might be extended in a future revision; for now they support a position element, to specify a superscript or subscript formatting, and a text case element.
The "normal" values may be used to override a parent style definition, when style inheritance is used.

#### Decorations {.unnumbered}
{.unnumbered}
#### Decorations

The ⟨decoration specification⟩ is an object which can contain any of the following elements.

Expand Down Expand Up @@ -70,7 +72,7 @@ It defaults to "solid" and "zizag" respectively.
The "thickness" defaults to `0.5pt`.

For instance, the `md-mark` style overrides the Markdown or Djot default rendering of the "highlight" syntax.
Let's ==mark some text== for the sake of demonstration, with the following style definition:
Let's {=mark some text=} for the sake of demonstration, with the following style definition:

```yaml
md-mark:
Expand Down Expand Up @@ -116,7 +118,8 @@ Some packages, however, accept negative "before kern" values for specific
use cases.
See, for instance, the section devoted to footnote markers.

#### Note on units {.unnumbered}
{.unnumbered}
#### Note on units

As a rule of thumb, the "kern" widths can include stretch and shrink
values (e.g. `10pt plus 2pt minus 1pt`). Be aware, however, that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ and different vertical skips here or there?
The styling paradigm offers a powerful generic abstraction towards that
goal.

### An opinionated note on alternatives {.unnumbered .notoc}
{.unnumbered .notoc}
### An opinionated note on alternatives

If you ever used (La)TeX, one possible way is to provide "hooks" that the user
can change. At places, SILE follows that approach too---either via commands that
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ there will be applied. The specification additionnaly provides:
- The alignment of the paragraph block (center, left, right or justify---the
latter is the default but may be useful to overwrite an inherited alignment).
- Rules applying before the paragraph block:

- The amount of vertical space before the content, as a variable length or a
named skip (such as `bigskip`, `medskip`, `smallskip`).
- Whether paragraph indentation is applied to the first paragraph (defaults
to `true`). Book sectioning commands, typically, usually set it to `false`,
for section titles not to be indented.
- Whether a page break may occur before the block (defaults to
`true`).
- Rules applying after the paragraph block

- Rules applying after the paragraph block

- The amount of vertical space after the content, as a variable length or a
named skip (such as `bigskip`, `medskip`, `smallskip`).
- Whether paragraph indentation is applied to the next paragraph after the
Expand All @@ -51,29 +54,31 @@ there will be applied. The specification additionnaly provides:
the first paragraph indentation after a section title. The French convention,
however, is to always indent regular paragraphs, even after a section title.

::: {custom-style="admon"}
{custom-style="admon"}
:::
This version of the specification does not provide any way to configure
the margins (left and right text block indents), internal skips, and other
low-level paragraph formatting options (paragraph indent, etc.)[^styles-par-margins]
:::

[^styles-par-margins]: This might be considered in a future revision, but note
that it may also be addressed by defining extra alignment options.
The **resilient.book** class, for instance, defines its own `block` alignment option
(used in block quotes, see further); the **resilient.verbatim** packages defines and `obeylines` alignment, etc.
The *resilient.book* class, for instance, defines its own `block` alignment option
(used in block quotes, see further); the *resilient.verbatim* packages defines and `obeylines` alignment, etc.

Please note that changing an existing character style into a paragraph style
does not imply that the content is magically turned into paragraphs.
When classes or packages expect a character style at some point, only
that part of the style definition is used. Classes and packages are responsible
for applying the paragraph part too, depending on context.

### Note on consecutive skips {.unnumbered}
{.unnumbered}
### Note on consecutive skips

Consider a "block quote" paragraph style, where you would expect some vertical spaces
both above and below a quotation---say, small skips---to make it more distinct
from the surrounding text.
The **resilient.book** class, for instance, provides the following default
The *resilient.book* class, for instance, provides the following default
style definition.

```yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ With these first assumptions in mind, let’s summarize the requirements:
to page headers, and so on.—The list of possibilities could be long here and very dependent on the kind of structure one considers, and it would be boresome to invent a
syntax covering all potential needs, so some sort of “hook” has at least to be provided
(more on that later).
- The main numbering, when used, may need some text strings prepended or appended to it,
(e.g. "Chapter 1.")
- The main numbering, when used, may need some text strings prepended or appended to it (e.g. "Chapter 1."),
- When added to page headers (or in similar contexts), as per the supporting class
design, one may want the section number to appear or not, and to be possibly
formatted in a different way than in the ToC or in the main text flow.
Expand Down Expand Up @@ -68,15 +67,12 @@ inheritance mechanism provided by the styles also allows one to reuse existing
base specifications. In this author’s opinion, it is quite flexible and clear.
The two last options, however, may require a clarification.

The `numberstyle` specification defines which number style should be used for
the section number, depending on the context where it appears (main text flow,
running headers and cross-references).^[In this version, the
numbering in the table of contents is handled with a different mechanism,
as a part of the ToC styles. Whether there is a need to reconcile these
solutions might be considered in a future revision.]
The `numberstyle` specification defines which number style should be used for the section number, depending on the context where it appears (main text flow, running headers and cross-references).[^toc-numbering-incertain]
Note that if a given context is absent, the section number will not be displayed.
This might be sufficient to disable inherited numbering in some contexts, but
in these cases, you can just leave the `main` number style present but empty.
This might be sufficient to disable inherited numbering in some contexts, but in these cases, you can just leave the `main` number style present but empty.

[^toc-numbering-incertain]: In this version, the numbering in the table of contents is handled with a different mechanism, as a part of the ToC styles.
Whether there is a need to reconcile these solutions might be considered in a future revision.

For the "main" number style, some sections may expect the number to be on its
own standalone line rather than just before the section title.—Chapters and parts,
Expand Down
File renamed without changes.
34 changes: 17 additions & 17 deletions examples/sile-resilient-manual.silm
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,23 @@ content:
- manual-layouts/layouts.sil
- file: manual-parts/part-styling.dj
content:
- manual-styling/basics/concepts.md
- manual-styling/basics/definitions.md
- manual-styling/basics/character.md
- manual-styling/basics/lists.md
- manual-styling/basics/paragraph.md
- manual-styling/basics/toc.md
- manual-styling/basics/sectioning.md
- manual-styling/advanced/intro.md
- manual-styling/advanced/folio.md
- manual-styling/advanced/footnotes.md
- manual-styling/advanced/toclevels.md
- manual-styling/advanced/liststyles.md
- manual-styling/advanced/eqno.md
- manual-styling/advanced/dropcap.md
- manual-styling/advanced/other.md
# unfinished
# - manual-styling/captioned.md
- manual-styling/basics/concepts.dj
- manual-styling/basics/definitions.dj
- manual-styling/basics/character.dj
- manual-styling/basics/lists.dj
- manual-styling/basics/paragraph.dj
- manual-styling/basics/toc.dj
- manual-styling/basics/sectioning.dj
- manual-styling/advanced/intro.dj
- manual-styling/advanced/folio.dj
- manual-styling/advanced/footnotes.dj
- manual-styling/advanced/toclevels.dj
- manual-styling/advanced/liststyles.dj
- manual-styling/advanced/eqno.dj
- manual-styling/advanced/dropcap.dj
- manual-styling/advanced/other.dj
# Not written yet...
# - manual-styling/advanced/captioned.dj
- file: manual-parts/part-packages.dj
content:
- manual-packages/packages.sil
Expand Down

0 comments on commit d225c73

Please sign in to comment.