Skip to content

Commit 7ccd74b

Browse files
authored
Merge pull request #150 from Omikhleia/docs-experimental-djot-indexes
docs: Support markup for indexed terms
2 parents 9ae2359 + 245e410 commit 7ccd74b

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

examples/sile-and-djot.dj

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,6 +1409,64 @@ They only apply to user-defined symbols (defined as pseudo-footnotes) and contex
14091409
We can't say if future versions of the Djot specification will make use of `?` and `!` in attributes or bracketed content.
14101410
Therefore, we recommend that you call template files containing conditional content with the `.djt` extension, as a way to remember.
14111411

1412+
1413+
### Index entries
1414+
1415+
Djot does not yet provide a built-in syntax for marking index entries within the text.
1416+
This converter supports two alternatives for that purpose: one following the standard attribute syntax, and another using a more compact shortcut syntax (offered as an experimental Djot extension).
1417+
1418+
Generating the actual indexes lies outside the scope of this converter.
1419+
It is the responsibility of the document class or supporting packages to provide the necessary commands and environments, as in the case of the *resilient* book class.
1420+
1421+
{#djot-index-entries-attributes}
1422+
#### Attributes for indexing entries
1423+
1424+
With the standard key–value attribute syntax, a term can be marked as belonging to a named index by means of explicit attributes, with the option to specify replacement text.
1425+
1426+
{custom-style=CodeBlock}
1427+
:::
1428+
```
1429+
[Peter Smith]{index=main indexed-main="Smith, Peter"} and Plato{index=main}
1430+
A deer{index=animals} and a hare{index=animals indexed-animals=rabbit}
1431+
```
1432+
:::
1433+
1434+
The `index` attribute specifies the indexes to which the term is added; multiple indexes can be listed by separating them with spaces.
1435+
Optionally, an `indexed-⟨index⟩` attribute may be provided to define the text that should appear in a given index, instead of the term itself.
1436+
1437+
{custom-style=CodeBlock}
1438+
:::
1439+
```
1440+
[Simon's Cat]{index="main animals genus" indexed-genus=Felis indexed-animals=cat}
1441+
```
1442+
:::
1443+
1444+
#### Shortcut syntax for indexing entries
1445+
1446+
The syntax above is fully valid Djot and thus portable to other converters.
1447+
However, it tends to be somewhat verbose and less than _lightweight_ in practice.
1448+
1449+
For convenience, our Djot implementation also supports a more compact, non-standard syntax that is easier to type.
1450+
1451+
{custom-style=CodeBlock}
1452+
:::
1453+
```
1454+
[John Doe]{:main="Doe, John"} and Aristote{:main}
1455+
A fox{:animals} or an ox{:animals=cow}
1456+
```
1457+
:::
1458+
1459+
As above, multiple indexes are possible too:
1460+
1461+
{custom-style=CodeBlock}
1462+
:::
1463+
```
1464+
[Simon's Cat]{index="main animals genus" indexed-genus=Felis indexed-animals=cat}
1465+
[Nils Olav III]{:main :animals="penguin" :genus=Aptenodytes}
1466+
```
1467+
:::
1468+
1469+
14121470
{#djot-configuration}
14131471
## Configuration
14141472

examples/sile-and-markdown.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,10 @@ This is one of the ways to use SILE commands in Djot.
13111311
While you could invoke _any_ SILE command with this feature, we recommend, though, to restrict it to styling.
13121312
Another more powerful way to leverage Djot with SILE’s full processing capabilities, and benefit from the best of both worlds, is to use the "raw" annotations, described in §[](#markdown-raw-inlines) and §[](#markdown-raw-blocks).
13131313

1314+
### Index entries
1315+
1316+
Markdown does not provide a built-in syntax for marking index entries within the text.
1317+
This converter supports index entries through the standard attribute syntax, in the same way as Djot (see §[](#djot-index-entries-attributes)).
13141318

13151319
## Configuration {#markdown-configuration}
13161320

0 commit comments

Comments
 (0)