Add image, math, inline syntax documentation

actions
trivernis 4 years ago
parent 7f44a4d243
commit d1fc3efa85
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

3
.gitignore vendored

@ -0,0 +1,3 @@
dist
.vscode
index.html

@ -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 = '''
<div style="font-size: 10px; text-align: center; width: 100%;">
<span class="pageNumber"></span>/<span class="totalPages"></span>
</div>'''
[pdf.margin]
top = 0.5
bottom = 0.5
[images]
max_width = 700
image_format = "png"
[style]
theme = 'MagicDark'
[custom_attributes]

@ -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`

@ -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

@ -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]`

@ -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 §[] |

@ -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]]
$$$
&nbsp;
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`.

@ -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

@ -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.

@ -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 |

@ -0,0 +1,62 @@
# Usage
## Basic Usage
```
snekdown 0.30.5
USAGE:
snekdown <SUBCOMMAND>
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] <input> <output>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-f, --format <format> the output format [default: html]
ARGS:
<input> Path to the input file
<output> Path for the output file
```
## Watching
```
USAGE:
snekdown watch [OPTIONS] <input> <output>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
--debounce <debounce> The amount of time in milliseconds to wait after changes
before rendering [default: 500]
-f, --format <format> the output format [default: html]
ARGS:
<input> Path to the input file
<output> Path for the output file
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

@ -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]

@ -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;
}
Loading…
Cancel
Save