From 600dd77e50ca9afaf415f1ec4672c2575a3923c1 Mon Sep 17 00:00:00 2001 From: Sol Fisher Romanoff Date: Fri, 15 Jul 2022 14:55:31 +0300 Subject: [PATCH] Add syntax document --- docs/syntax.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 docs/syntax.md diff --git a/docs/syntax.md b/docs/syntax.md new file mode 100644 index 0000000..0d6033a --- /dev/null +++ b/docs/syntax.md @@ -0,0 +1,69 @@ +# Misskey-flavored Markdown syntax and cheat sheet + +this document acts as the canonical source of information about MFM implemented +by `marked-mfm`. if you are looking for the implementation used in Misskey, refer +to [this page on +`mfm.js`](https://github.com/misskey-dev/mfm.js/blob/develop/docs/syntax.md). + +## Markdown-to-HTML parser + +all MFM elements are parsed to HTML like so: + +```html +text +``` + +refer to the rest of the document for information on tags and parameters. + +## MFM tags + +| MFM | summary | +|------------------|--------------------------------------------| +| `$[tada text]` | "tada!"-like animation | +| `$[jelly text]` | squashing and stretching animation | +| `$[twitch text]` | stuttering animation | +| `$[shake text]` | stuttering and rotating animation | +| `$[spin text]` | spinning animation | +| `$[jump text]` | jumping animation | +| `$[bounce text]` | jumping and squashing animation | +| `$[flip text]` | mirrors the element | +| `$[x2 text]` | big text | +| `$[x3 text]` | bigger text | +| `$[x4 text]` | even bigger text | +| `$[font text]` | sets a font do display the content in | +| `$[rotate text]` | rotates the element by a number of degrees | + +## optional parameters + +some MFM elements allow specifying additional attributes in the tag. this is +done by adding a `.` to the tag name, followed by a comma-separated list of +attributes. + +example: `$[spin.alternate,speed=3s text]` + +- **`speed`** + *valid in: `jelly`, `twitch`, `shake`, `spin`* + a number, in seconds, that defines the duration of the animation + example: `$[jelly.speed=2s text]` +- **`h`, `v`** + *valid in: `flip`* + defines the axis the element is flipped upon; horizontally, vertically, or + both + example: `$[flip.h.v text]` +- **`x`, `y`** + *valid in: `spin`* + defines the axis on which to spin the element + example: `$[spin.x text]` +- **`alternate`, `left`** + *valid in: `spin`* + defines whether to run the spinning animation in reverse, or to alternate it + example: `$[spin.left text]` +- **`serif`, `monospace`, `cursive`, `fantasy`, `emoji`, `math`** + *valid in: `font`* + sets the font inside the font element; if unset, the element does nothing + example: `$[font.fantasy text]` +* **`deg`** + *valid in: `rotate`* + a number of degrees to rotate the element; if unset, 30° is used + example: `$[rotate.deg=120 text]` +