~akarle/nihdoc

Lightweight markup parser that's Invented Here
build: Add support for plan9
style: Convert whole source to adhere to style(9)
Add CI via builds.sr.ht

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~akarle/nihdoc
read/write
git@git.sr.ht:~akarle/nihdoc

You can also use your local clone with git send-email.

# `nihdoc`

	Not Invented Here Doc
	-   -        -    ---

>  "because markdown isn't in base!"
>
>     ~akarle


## Description

`nihdoc` is my take at a light markup language to improve my
time-to-publish on blog posts. I concede up front that others
should likely use markdown, which is both prettier and more
well-known, but as a personal challenge I try to keep my blog
publishable under *only the OpenBSD base system*. Since there's
no markdown parser in base, I had to write my own!

Probably the most interesting feature is that it's is a streaming
parser using only constant space. In other words, it only reads
the input once, never scans, and doesn't store the input in
memory. You can see this if you run it interactively: `cat | nihdoc`.

## Usage

`nihdoc` reads from stdin and prints HTML snippets to stdout. No
arguments are read and no files are accessible (on OpenBSD this
is enforced via pledge(2)). Common usage is:

	$ (cat header.html; nihdoc < file.txt; cat footer.html) > file.html

## Support

-  #|##|### headers
-  <p> tags around paragraphs (allowed to wrap!)
-  - bullets, breaks allowed if indented
-  1. numerical lists, breaks allowed if indented
-  > quotes
-  TAB code blocks
-  Inline `code`, _italics_, and *bold*
-  Escaping via \\
-  Links:  [my site](https://alexkarle.com)  or  [https://alexkarle.com]

## TODO

- Mixed lists