Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ For casual readers, this collection notably aims at easily converting Djot or Ma

## Installation

This module collection requires SILE v0.14 or upper.
This module collection requires SILE v0.14 or upper (recommended: v0.15.10).

Installation relies on the **luarocks** package manager.

Expand Down Expand Up @@ -153,7 +153,7 @@ This is but an overview. For more details, please refer to the provided example
- Raw inline HTML convenience subset in Markdown
- Advanced use of symbols in Djot (variable substitution ,and templating)
- Advanced configuration (e.g. Markdown variants, headings shifting, etc.)
- Bibliography citations (when appropriate support is enabled)
- Bibliography citations

## Use with the resilient collection

Expand Down
3 changes: 3 additions & 0 deletions examples/biblio.dj
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Selected bibliography

:_BIBLIOGRAPHY_:
6 changes: 3 additions & 3 deletions examples/introduction.dj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Yet, these options remain available under the hood for those seeking a blend of

### Standard installation

This module collection requires SILE v0.14 or upper.
This module collection requires SILE v0.14 (recommended: v0.15.10 or upper).

Installation relies on the *luarocks* package manager.
To install the latest version, you may use the provided “rockspec”:
Expand Down Expand Up @@ -148,7 +148,7 @@ Let's illustrate this for Djot, but the same applies to Markdown.

{custom-style=CodeBlock}
:::
```
```sil
\use[module=packages.djot]
\include[src=somefile.dj]
```
Expand All @@ -159,7 +159,7 @@ Again, the same applies to Markdown.

{custom-style=CodeBlock}
:::
```
```sil
\begin[type=djot]{raw}
Some *Djot* content
\end{raw}
Expand Down
2 changes: 1 addition & 1 deletion examples/lightweight-markup.dj
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Beyond technical considerations, it's also worth examining the functionality of
Markdown can be intricate, with subtle nuances where even a single space can trigger unexpected effects.
It exhibits non-intuitive behaviors, such as the use of indentation to denote code blocks.
There are inconsistent outcomes with lists, emphases, headings...
See John MacFarlane's ["Beyond Markdown"](https://johnmacfarlane.net/beyond-markdown.html) essay for some more examples, and the reasons that led him propose Djot.
See John MacFarlane's ["Beyond Markdown"](https://johnmacfarlane.net/beyond-markdown.html) essay for some more examples, and the reasons that led him propose Djot [@djot:macfarlane2018].

: Extensibility

Expand Down
15 changes: 12 additions & 3 deletions examples/markdown-djot.bib
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
@book{sile,
title = {The SILE Book},
author = {Cozens, Simon and Maclennan, Caleb and Nicole, Olivier and Willis, Didier},
year = {2014–202X},
year = {2025},
edition = {version 0.15.10},
}

@book{sile:willis2021,
title = {The re·sil·ient collection of classes & packages for SILE: User Guide},
author = {Willis, Didier},
year = {2021–},
year = {2025},
}

@book{sile:willis2022,
title = {Markdown and Djot to PDF with SILE: Ultimate Guide & Showcase Document},
author = {Willis, Didier},
year = {2022–},
origdate = {2022},
year = {2025},
}

@book{sile:willis2024,
title = {SILE and the Hydra of Maths. Showcase & Critical Assessment 2024},
author = {Willis, Didier},
year = {2024},
}

@article{djot:macfarlane2018,
author = {MacFarlane, John},
title = {Beyond Markdown},
year = {2018},
url = {https://talk.commonmark.org/t/beyond-markdown/2787},
}
11 changes: 6 additions & 5 deletions examples/sile-and-djot.dj
Original file line number Diff line number Diff line change
Expand Up @@ -524,16 +524,17 @@ This implementation, however, recognizes a simplified subset of the Pandoc citat
:::
```
I wrote a whole book on mathematics with SILE [@sile:willis2024].
... also supported [@sile:willis2024; @sile:willis2022].
... a "master document" [@sile:willis2021, part 1].
... _The SILE Book_ for more information [@sile, chapter 5].
```
:::

I wrote whole book on mathematics with SILE [@sile:willis2024].
Note that multiple citations are also supported [@sile:willis2024; @sile:willis2022].

How to load bibliographies and configure citation styles is beyond the scope of this manual.
If you are using the resilient collection, the most natural way to do this is a "master document" [@sile:willis2021, part 1].
Note that support for biblibraphies in SILE is an experimental feature, so you may also want to check _The SILE Book_ for more information [@sile, chapter 5].
With the resilient collection, the most natural way to do this is a "master document" [@sile:willis2021, part 1].
For more information, you may also want to check _The SILE Book_ [@sile, chapter 5].

{#djot-symbols}
### Symbols
Expand Down Expand Up @@ -1422,7 +1423,7 @@ For instance, you can include a Djot file with shifted headings like this:

{custom-style=CodeBlock}
:::
```
```sil
\include[src=somefile.dj, shift_headings=1]
```
:::
Expand All @@ -1431,7 +1432,7 @@ For document classes supporting it (in particular, the *resilient* book class),

{custom-style=CodeBlock}
:::
```
```sil
\include[src=somefile.dj, shift_headings=-1]
```
:::
2 changes: 0 additions & 2 deletions examples/sile-and-markdown-manual-styles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -982,8 +982,6 @@ sectioning-appendix-main-number:
origin: "resilient.book"
style:
numbering:
before:
text: "Appendix "
display: "ALPHA"

sectioning-appendix-ref-number:
Expand Down
31 changes: 17 additions & 14 deletions examples/sile-and-markdown-manual.silm
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ metadata:
- Pandoc
authors: Didier Willis
publisher: Omikhleia
pubdate: 2024-03-01
pubdate: 2025-03-21
url: https://github.com/Omikhleia/markdown.sile
copyright: © 2022–2024, Didier Willis.
copyright: © 2022–2025, Didier Willis.
legal: |
This material may be distributed only subject to the terms and conditions
set forth in the Creative Commons Attribution, Share-Alike License,
Expand All @@ -37,22 +37,25 @@ sile:
layout: division 9
resolution: 300
settings:
textsubsuper.fake: false
textsubsuper.fake: true
autodoc.highlighting: true
document.baselineskip: 1.2em
# typesetter.italicCorrection: true # Not yet available in SILE 0.14.x
typesetter.italicCorrection: true
packages:
- autodoc-resilient # REQUIRED FOR RESILIENT, do not use regular autodoc
- dropcaps
- resilient.defn
- resilient.poetry
chapters:
- toc.dj
- extra-styles.dj
- introduction.dj
- lightweight-markup.dj
- sile-and-djot.dj
- sile-and-markdown.md
- sile-and-pandoc.dj
- pandoc-tables.pandoc
- final-notes.dj
content:
chapters:
- toc.dj
- extra-styles.dj
- introduction.dj
- lightweight-markup.dj
- sile-and-djot.dj
- sile-and-markdown.md
- sile-and-pandoc.dj
- pandoc-tables.pandoc
- file: final-notes.dj
content:
- biblio.dj
19 changes: 9 additions & 10 deletions examples/sile-and-markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,16 +512,17 @@ This implementation recognizes a simplified subset of the Pandoc citation syntax
::: {custom-style=CodeBlock}
```
I wrote a whole book on mathematics with SILE [@sile:willis2024].
... also supported [@sile:willis2024; @sile:willis2022].
... a "master document" [@sile:willis2021, part 1].
... _The SILE Book_ for more information [@sile, chapter 5].
```
:::

I wrote whole book on mathematics with SILE [@sile:willis2024].
Note that multiple citations are also supported [@sile:willis2024; @sile:willis2022].

How to load bibliographies and configure citation styles is beyond the scope of this manual.
If you are using the resilient collection, the most natural way to do this is a "master document" [@sile:willis2021, part 1].
Note that support for biblibraphies in SILE is an experimental feature, so you may also want to check _The SILE Book_ for more information [@sile, chapter 5].
With the resilient collection, the most natural way to do this is a "master document" [@sile:willis2021, part 1].
For more information, you may also want to check _The SILE Book_ [@sile, chapter 5].

### Symbols

Expand Down Expand Up @@ -895,15 +896,13 @@ In most cases, the content is rendered as verbatim text, with some exceptions de
Erm... Markdown supports yet another syntax for loosely defined verbatim code blocks, which is the "indented code block" syntax.
This author would rather not recommend using it, and frow upon the indentation ambiguities it introduces in some cases.

::: {custom-style=CodeBlock}
This is an indented code block.
:::
This is a code block.

This is obtained by indenting the content by at least four spaces...

::: {custom-style=CodeBlock}
```
This is an indented code block.
This is a code block.
```
:::

Expand Down Expand Up @@ -1326,15 +1325,15 @@ In SIL documents, you can pass such options to the `\include` command or the `ra
For instance, you can include a Markdown file with shifted headings like this:

::: {custom-style=CodeBlock}
```
```sil
\include[src=somefile.md, shift_headings=1]
```
:::

For document classes supporting it (in particular, the **resilient** book class), this feature also allows you to access levels above the default scheme, such as "parts".

::: {custom-style=CodeBlock}
```
```sil
\include[src=somefile.md, shift_headings=-1]
```
:::
Expand All @@ -1356,7 +1355,7 @@ Available options are: `smart`, `smart_primes`, `strikeout`, `mark`, `subscript`
For instance, to disable the smart typography feature:

::: {custom-style=CodeBlock}
```
```sil
\include[src=somefile.md, smart=false]
```
:::
2 changes: 1 addition & 1 deletion examples/sile-and-pandoc.dj
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Once the package is loaded, the `\autodoc:command{\include[src=<file>]}`{=sile}

{custom-style=CodeBlock}
:::
```
```sil
\use[module=packages.pandocast]
\include[src=somefile.pandoc]
```
Expand Down
4 changes: 3 additions & 1 deletion examples/toc.dj
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
```=sile-lua
SILE.call("open-on-odd-page")
SILE.call("noheaders")
```

{.unnumbered .notoc}
# Contents

:_TOC_:
8 changes: 1 addition & 7 deletions packages/markdown/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function package:_init (_)
-- The class should be responsible for loading the appropriate higher-level
-- constructs, see fallback commands further below for more details.
self:loadPackage("bibtex")
SILE.settings:set("bibtex.style", "csl") -- The future is CSL
SILE.settings:set("bibtex.style", "csl") -- The future is CSL (active by default with SILE 0.15.10)
self:loadPackage("color")
self:loadPackage("embedders")
self:loadPackage("highlighter")
Expand Down Expand Up @@ -840,12 +840,6 @@ Please consider using a resilient-compatible class!]])
end
end, "Symbol in Djot (internal)")

self:registerCommand("markdown:internal:citations", function (_, content)
-- We cannot handle multiple citations yet in a single call.
-- See https://github.com/sile-typesetter/sile/issues/2196
SILE.process(content)
end, "Citations (internal)")

-- B. Fallback commands

self:registerCommand("markdown:fallback:blockquote", function (_, content)
Expand Down
9 changes: 8 additions & 1 deletion packages/markdown/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,14 @@ local function naiveCitations (str, pos)
end
return createCommand("cite", { key = key }, nil, pos)
end, refs)
return createStructuredCommand("markdown:internal:citations", {}, refs, pos)
if #refs == 0 then
SU.warn("No valid citation reference found in '" .. str .. "'")
return {}
end
if #refs == 1 then
return refs[1]
end
return createStructuredCommand("cites", {}, refs, pos)
end

--- @export
Expand Down
2 changes: 1 addition & 1 deletion rockspecs/markdown.sile-2.4.0-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ description = {
dependencies = {
"lua >= 5.1",
"embedders.sile >= 0.2.0",
"highlighter.sile >= 0.2.0",
"highlighter.sile >= 0.2.1",
"labelrefs.sile >= 0.1.0",
"ptable.sile >= 3.2.0",
"smartquotes.sile >= 1.0.0",
Expand Down