1
0
Fork 0
mirror of https://github.com/lise-henry/crowbook synced 2024-05-24 01:46:04 +02:00
crowbook/guide/03_markdown.md
2022-02-23 01:55:16 +01:00

3.5 KiB

Markdown format

crowbook uses pulldown-cmark, which is an implementation of CommonMark, so for more information on Markdown syntax, you can refer to those websites.

However, pulldown-cmark also implements a handful of unofficial extensions, and crowbook also adds its own variants, so there are a few syntax elements that are not covered by the CommonMark reference.

Tables

Tables can be included in your Markdown file.

E.g.:

|        Author      |   Book                     |
|--------------------|----------------------------|
| Anne Rice          | Interview With the Vampire |
| Terry Pratchett    | Hogfather                  |
| George Martin      | A Dance with Dragons       |

will render as

Author Book
Anne Rice Interview With the Vampire
Terry Pratchett Hogfather
George Martin A Dance with Dragons

Crowbook doesn't currently support specifying column alignment.

Footnotes

Footnotes can be specified the following way:

Footnotes can be useful[^1] and make you look clever.

[^1]: But you shouldn't use them too much.

Will be rendered as:

Footnotes can be useful1 and make you look clever.

You can use multiple paragraphs in a footnote definition. This can sometimes be useful, but it can also be tricky, as if you only let an empty line before the next paragraph, it will also be included in the footnote. And probably the next one and the following one too:

This is a footnote usage[^1].

[^1]: This is obviously part of the footnote definition.

This is less obviously ALSO part of the footnote definition.


This is NOT part of the foonote.

Due to its own quirks, crowbook will duplicate footnotes if you reference them multiple times:

This footnote is unique[^2] but referenced twice[^2].

[^2]: Or is it?

This footnote is unique2 but referenced twice2.

Superscript and subscript

Crowbook v0.12.0 added experimental support for superscript and subscript, using respectively foo^up^ and bar~down~ syntax, which will render as "foo^up^" and "bar~down~"; this feature is quite a hack above the Markdown parsing library, and as such might cause issue if you mix it with other Markdown syntax elements (or, in the previous example, for smart quote detection). This is why you'll need to enable it with crowbook.mardown.superscript.

"Standalone" images

This is not per se a new syntactic element, but Crowbook distinguish two kind of images, according to their position in the document:

  • standalone images, which are the only elements of a paragraph;
  • inline images, which are placed in a container containing other elements.

Standalone images will typically be resized to fill the width of the page, while inline images are not resized.

This image is on its own paragraph, and thus considered "standalone" and resized to fit width:

Logo

While this one Logo is embedded in a paragraph and its size is unchanged.

Interactive fiction

crowbook also adds some syntax for interactive fiction, to make embedding Javascript code easier. It is only enabled for the interactive fiction renderer. For more information, see the chapter on this matter.


  1. But you shouldn't use them too much. ↩︎

  2. Or is it? ↩︎