Shrimple: a better, cleaner Markdown alternative.
Shrimple
better ,<br>cleaner<br>Markdown alternative.<br>Get it.
This is a Shrimple document. It's written in such a way that it looks clean and<br>readable both as a text document, but also when rendered into HTML.
Installation & Usage
You'll need a Go compiler to compile it first:
go build
Then run it like this:
cat README | ./shrimple -s -w > README.html
The<br>-s<br>or<br>--default-css<br>flag adds a default css to the HTML output and<br>-w<br>or<br>--wrap<br>flag wraps the page up in HTML to make a complete document. If you're<br>looking to generate output and insert into your own website one way or another,<br>you're not going to need those tags.
To see all available options type:<br>./shrimple --help
Links and Footnotes
Links are made to be clean-looking as well. Instead of polluting the source<br>document with inline URLs (which can be long and can mess up readability)<br>we instead use a very<br>shrimple!<br>idea: a link gets its URLs from<br>the footnote it's referring to.
Of course, you can also add a regular footnote
, in which case the little<br>link with the number next to the word will lead you to the footnote section.
Code
Let's start with code blocks. Look at the example below: even though there's an<br>empty line between the two<br>if<br>blocks, it'll still be one singular block of code:
if err != nil {<br>return -1
if err == nil {<br>return 1
Blocks of code must be indented with 6 spaces, which, when rendered, will be<br>trimmed, but the extra spaces after the first 6 are kept. The first line of<br>the code block which starts with<br>### Go<br>is optional, but it adds an HTML-class<br>to the code block tag, which, when used with<br>Prism.js<br>code highlighter,<br>will result in correct code highlighting for a particular language.
We can also have inline code, such as<br>fmt.Println("this is inline code")
Lists
Shrimple also allows you to create numbered and bullet lists.<br>For example, here's a list with bullet points:
Lists must be indented two spaces to the right
Each item may or may not be separated from the<br>previous one by an empty line.
If a list item is long, you can easily put the content<br>on the next line. In that case, the subsequent lines must all be<br>indented with 4 spaces to be aligned with the first line.
Very similar are numbered lists:
Indentation is the same — two spaces.
Subsequent items may be numbered normally (unlike Markdown,<br>where they all have to be "1").
Subsequent lines in any given numbered list item must be<br>aligned by the fullstop character "." on the first line.
Numbers don't have to be consequtive, but they<br>will be normalized to be consequtive.<br>It just<br>werks!
Two types of headers
Headers are allowed to be of two level types: "h1" and "h2".<br>The level is determined by the "thickness" of the underscore line,<br>where === is for "h1" and --- is for "h2". One important thing about headers:<br>the line following the actual header, regardless of the time, must always be<br>at least 3 characters long (it is a hardcoded rule) or the line above will not<br>be rendered as a header.
Notes start with a line which consists of one word in<br>uppercase (no spaces) optionally followed by any punctuation<br>sign — in this case it's ":". The following lines must be<br>indented with 4 spaces. The word doesn't have to be "NOTES" and,<br>instead, can be something like "SIDENOTE" or "ATTENTION". The<br>word itself will be downcased and used in the output as html<br>tag css class.
Notes may also contain empty lines (with no indentation), but<br>an empty line must be surrounded by non-empty ones belonging<br>to this note (and, thus, indented with 4 spaces) in order to be<br>considered part of the note.
Parse & render dictionaries
This is one of the most powerful features of Shrimple. Instead of polluting your<br>original document with various kinds of strange characters or HTML, you just<br>write your text and when need to highlight some occurrences of particular words<br>or expressions, you define it using Parse & Render dictionaries. Take a look at<br>the two files:<br>parse_dict<br>and<br>render_dict<br>in the repository's root directory<br>and then look at the example in the next paragraph:
This paragraph is an example of parse and render dictionaries. Note that the<br>word1<br>and<br>word2<br>are underlined, and
word3
and
expression with some spaces in it
are green. But there's no additional markup for these words in the source<br>Shrimple document. They're simply picked up based on the parse and render<br>dictionaries.
To instruct Shrimple to make use of parse and render dictionaries, use the<br>-p<br>and the<br>-r<br>cli-arguments ("p" for parse, and "r" for render):
./shrimple ... -p path/to/parse_dict -r path/to/render_dict
Generating static website
One of the goals of Shrimple always was to be able to generate documentation<br>pages. This his made possible by Shrimple's static site generator. It will<br>take a directory of source files (written in Shrimple format), convert each file<br>into an HTML-document and output it all into another directory. Each page will<br>optionally contain a menu...