diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a65e830 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +dist +.vscode +index.html \ No newline at end of file diff --git a/Bibliography.toml b/Bibliography.toml new file mode 100644 index 0000000..e69de29 diff --git a/Glossary.toml b/Glossary.toml new file mode 100644 index 0000000..e69de29 diff --git a/Manifest.toml b/Manifest.toml new file mode 100644 index 0000000..c86abc2 --- /dev/null +++ b/Manifest.toml @@ -0,0 +1,35 @@ +[metadata] +language = 'en' +author = 'Trivernis' +title = 'Snekdown' + +[features] +embed_external = true +smart_arrows = true +include_mathjax = true + +[imports] +ignored_imports = [] +included_stylesheets = [] +included_bibliography = ['Bibliography.toml'] +included_glossaries = ['Glossary.toml'] + +[pdf] +display_header_footer = true +footer_template = ''' +
+ / +
''' + +[pdf.margin] +top = 0.5 +bottom = 0.5 + +[images] +max_width = 700 +image_format = "png" + +[style] +theme = 'MagicDark' + +[custom_attributes] diff --git a/README.md b/README.md new file mode 100644 index 0000000..5753dbd --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Snekdown docs + +[Hosted Version](https://trivernis.net/snekdown) + +## How to build it + +1. Clone the repository +2. Install [Snekdown](https://github.com/trivernis/snekdown) (if you haven't already) +3. `snekdown render main.md index.html` \ No newline at end of file diff --git a/chapters/centered-text.md b/chapters/centered-text.md new file mode 100644 index 0000000..79f6bff --- /dev/null +++ b/chapters/centered-text.md @@ -0,0 +1,11 @@ +# Centered Text + +With snekdown text can be centered. +Centering works on line level, so it only centers elements that +are line elements. (Text, Images, urls etc.) + +``` +|| A centered line +``` + +|| A centered line \ No newline at end of file diff --git a/chapters/images.md b/chapters/images.md new file mode 100644 index 0000000..8d863d0 --- /dev/null +++ b/chapters/images.md @@ -0,0 +1,55 @@ +# Image Syntax + +Simple Syntax +`!(url)` + + +Extended syntax with a description +`![description](url)` + + +Extended syntax with metadata to specify the size +`![description](url)[metadata]?` + + +Extended syntax with metadata and no description +`!(url)[metadata]` + + +When generating the html file the images are base64 embedded. To turn off this behaviour +set the config parameter `embed-external` to `false`. + + +## Manipulation + +With the provided metadata images can be manipulated: + + +![Original](img/snek.png)[width=20%] +|| `![Original](img/snek.png)[width=20%]` + + +![Grayscale](img/snek.png)[width=20% grayscale] +|| `![Grayscale](img/snek.png)[width=20% grayscale]` + +![Invert](img/snek.png)[width=20% invert] +|| `![Grayscale](img/snek.png)[width=20% invert]` + + +![Hue Shift](img/snek.png)[width=20% huerotate=90] +|| `![Hue Shift](img/snek.png)[width=20% huerotate=90]` + + +![Adjust Brightness](img/snek.png)[width=20% brightness=100] +|| `![Adjust Brightness](img/snek.png)[width=20% brightness=100]` + + +![Adjust Contrast](img/snek.png)[width=20% contrast=50] +|| `![Adjust Contrast](img/snek.png)[width=20% contrast=50]` + + +The image manipulations can also be combined. The order of execution can not be changed. + + +![Cursed](img/snek.png)[width=20% grayscale invert huerotate=90 brightness=100 contrast=50] +|| `![Cursed](img/snek.png)[width=20% grayscale invert huerotate=90 brightness=100 contrast=50]` \ No newline at end of file diff --git a/chapters/inline-syntax.md b/chapters/inline-syntax.md new file mode 100644 index 0000000..f1f4afd --- /dev/null +++ b/chapters/inline-syntax.md @@ -0,0 +1,12 @@ +# Inline Text Formatting + +| Formatting | Rendered | +| ---------- | -------- | +| `*italic*` | *italic* | +| `**Bold**` | **Bold** | +| `~~Striked~~` | ~~Striked~~ | +| `_Underlined_` | _Underlined_ | +| \`Monospace\` | `Monospace ` | +| `:emoji:` | :snake: | +| `§[#0C0]Colored§[]` | §[#0C0] Colored §[] | + diff --git a/chapters/math.md b/chapters/math.md new file mode 100644 index 0000000..9b47bd3 --- /dev/null +++ b/chapters/math.md @@ -0,0 +1,25 @@ +# Math + +Math annotations can be created with the [AsciiMath](http://asciimath.org/) Syntax. +The parser is implemented in it's own crate [asciimath-rs](https://github.com/Trivernis/asciimath-rs). + +Inline math: +```md +Inline math $$ a^2 + b^2 = c^2 $$ in one line. +``` +Inline math $$ a^2 + b^2 = c^2 $$ in one line. + + +Block Math: +``` +$$$ +A = [[1, 2],[3,4]] +$$$ +``` +$$$ +A = [[1, 2],[3,4]] +$$$ +  + +Snekdown uses [MathJax](https://www.mathjax.org/) for improving the output of rendered MathML expressions. +Browsers like Firefox support rendering of MathML directly so it's not a requirement to use it there. It can be turned off with the feature setting `include_mathjax`. \ No newline at end of file diff --git a/chapters/quotes.md b/chapters/quotes.md new file mode 100644 index 0000000..dae56f5 --- /dev/null +++ b/chapters/quotes.md @@ -0,0 +1,24 @@ +# Quotes + +Snekdown supports standard markdown quotes with `>` and quotes with additional metadata: + +Simple (default) Syntax: +``` +> This is a quote +``` +> This is a quote + + +Multiline Quotes: +```md +> This is a +> Multiline Quote +``` +> This is a +> Multiline Quote + +You can even add add additional metadata to quotes, like the autor or year: +```md +[author=Trivernis year=2020 display='{{author}} - {{year}}']> This is a quote with metadata +``` +[author=Trivernis year=2020 display='{{author}} - {{year}}']> This is a quote with metadata \ No newline at end of file diff --git a/chapters/smart-arrows.md b/chapters/smart-arrows.md new file mode 100644 index 0000000..b2718e5 --- /dev/null +++ b/chapters/smart-arrows.md @@ -0,0 +1,6 @@ +# Smart Arrows + +Snekdown automatically renders the sequences `-->`, `==>`, `<--`, `<==`, `<-->`, `<==>` as +their respective unicode arrows (similar to [markdown-it-smartarrows](https://github.com/adam-p/markdown-it-smartarrows)): +-->, ==>, <--, <==, <-->, <==> +This behavior can be turned off by setting the feature `smart_arrows` to `false` in the config. \ No newline at end of file diff --git a/chapters/tables.md b/chapters/tables.md new file mode 100644 index 0000000..13ed7b0 --- /dev/null +++ b/chapters/tables.md @@ -0,0 +1,13 @@ +# Tables + +Tables work just like regular markdown tables: +```md +| header | header | header | +|--------|--------|---------| +| row | row | row | +| row | row | row | +``` +| header | header | header | +|--------|--------|---------| +| row | row | row | +| row | row | row | \ No newline at end of file diff --git a/chapters/usage.md b/chapters/usage.md new file mode 100644 index 0000000..ca00934 --- /dev/null +++ b/chapters/usage.md @@ -0,0 +1,62 @@ +# Usage + +## Basic Usage + +``` +snekdown 0.30.5 + +USAGE: + snekdown + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +SUBCOMMANDS: + clear-cache Clears the cache directory + help Prints this message or the help of the given subcommand(s) + render Parse and render the document + watch Watch the document and its imports and render on change +``` + + +## Rendering + +``` + +USAGE: + snekdown render [OPTIONS] + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +OPTIONS: + -f, --format the output format [default: html] + +ARGS: + Path to the input file + Path for the output file +``` + + +## Watching + +``` +USAGE: + snekdown watch [OPTIONS] + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +OPTIONS: + --debounce The amount of time in milliseconds to wait after changes + before rendering [default: 500] + -f, --format the output format [default: html] + +ARGS: + Path to the input file + Path for the output file +``` + diff --git a/img/snek.png b/img/snek.png new file mode 100644 index 0000000..37ec39f Binary files /dev/null and b/img/snek.png differ diff --git a/main.md b/main.md new file mode 100644 index 0000000..2ebdd40 --- /dev/null +++ b/main.md @@ -0,0 +1,42 @@ +#[toc-hidden] || Snekdown Documentation (WIP) + +|| written in Snekdown on [[date]] + + + +- - - +##[toc-hidden] Table of Contents + +[[TOC]] + +- - - + +<[chapters/usage.md] + +- - - + +<[chapters/inline-syntax.md] + +- - - + +<[chapters/quotes.md] + +- - - + +<[chapters/tables.md] + +- - - + +<[chapters/centered-text.md] + +- - - + +<[chapters/smart-arrows.md] + +- - - + +<[chapters/math.md] + +- - - + +<[chapters/images.md] \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..136d30a --- /dev/null +++ b/style.css @@ -0,0 +1,42 @@ +body { + background-color: #112; +} + +.content { + background-color: #223; + color: white; +} + +code pre { + background-color: #334 !important; + color: white; +} + +a { + color: #AAF +} + +code.inlineCode { + background-color: #334; + color: white; +} + +table tr:nth-child(1) { + background-color: #252535; +} + +table tr:nth-child(odd) { + background-color: #252535; +} + +table td, table th { + border-left: 1px solid white; +} + +table th { + border-bottom: 1px solid white; +} + +hr { + color: #88C; +} \ No newline at end of file