Crate yamd

source ·
Expand description

§Yamd - yet another markdown document flavour

Yamd is a markdown document flavour that allows to create rich documents with images, code, and more.

§Syntax

Each yamd document starts with metadata section which is YAML document surrounded by “—”. Metadata has next fields: title, date, image, preview, is_draft, and tags.

Timestamp format: “%Y-%m-%dT%H:%M:%S%z” (specifiers description)

Tags are array of strings.

is_draft is a boolean value.

Example:

---
title: Yamd - yet another markdown document flavour
date: 2023-01-01 00:00:00 +0000
image: /image.png
preview: Here you can find out more about yamd
is_draft: true
tags:
- markdown
- rust
---

§Elements:

§List

Can contain nested lists. Each nesting level equals to number of spaces before list item.

§Unordered list

Starts with “- “ and ends with a new line

§Ordered list

Starts with “+ “ and ends with a new line

Example:

- item 1
- item 2
 + ordered nested list
  - can have nested unordered list inside ordered list
 + one more ordered item
- item 3

§Code

Element that starts with “```lang\n”, ends with “\n```” and has code in between.

Example:

\```rust
let x = 1;
\```

^ did not figured out how to escape ``` in rustdoc

§Image

Element that starts with “!” has image alt text in [] and followed by image url in ()

Example:

![alt text](url)

§ImageGallery

Element that starts with “!!!\n”, ends with “\n!!!”, and has image elements in between

Example:

!!!
![alt text](url)
![alt text](url)
!!!

§Highlight

Element that starts with “>>>\n”, followed by optional title that starts with “>> “ and ends with a new line, followed by optional icon specifier that starts with “> “ and ends with a new line, followed by body that can contain any number of paragraph elements

Example:

>>>
>> Title
> icon
body

can be multiple paragraphs long
>>>

no header and no icon:

>>>
body
>>>

§Divider

Element that consist of five “-” characters in a row and ends with a new line or EOF.

Example: -----

§Embed

Element that starts with “{{” followed by embed type, followed by “|” followed by embed url, followed by “}}” and ends with a new line or EOF.

Example: {{youtube|https://www.youtube.com/embed/wsfdjlkjsdf}}

§Paragraph

Element that starts with any character that is not a special character and ends with a new line or EOF. Can contain text, bold text, italic text, strikethrough text, anchors, and inline code.

§Anchor

element that starts with “[” followed by text, followed by “]” followed by “(” followed by url, followed by “)”

example: [Yamd repo](https://github.com/Lurk/yamd)

§Inline code

element that starts with “`” followed by text and ends with “`”

example: `inline code`

§Italic text

element that starts with “_” followed by text and ends with “_”

example: _italic text_

§Strikethrough text

element that starts with “~~” followed by text and ends with “~~”

example: ~~strikethrough text~~

§Bold text

element that starts with “**” followed by text and ends with “**”

example: **bold text**

Bold text can also contain italic text and strikethrough text

example: **bold _italic_ text** or **bold ~~strikethrough~~ text**

Altogether: text **bold _italic_ text** ~~strikethrough~~ text `inline code` [Yamd repo](url) will be parsed into Paragraph

§Collapsible

Collapsible element can contain all from the above

Example:

{% Title
some random text
%}

Nested collapsible elements example:

{% Title
some random text

{% Nested title
some random text
%}
%}

§Heading

Element that starts with one to seven “#” characters followed by space, followed by text and/or link, and ends with a new line or EOF

Example: # header or ###### header or # [header](url) or # header [link](url)

Modules§

Functions§