nihdoc

WIP markup parser (txt -> html)
git clone git://git.alexkarle.com.com/blag
Log | Files | Refs | README | LICENSE

commit 3105b8c311e51cd27dbfec6185cab57c18775d52 (patch)
parent 0d53d6e8b4ed96eb0f686f9dd41ee0e74201f939
Author: Alex Karle <alex@alexkarle.com>
Date:   Sat, 18 Dec 2021 01:28:02 -0500

Add README and promote to its own repo!

At this point, I want to preserve its history beyond the life of
my site :) I suspect it may not be used for alexkarle.com OR there will
be another iteration.. keeping it in its own repo will allow
shareability beyond its actual use.

Diffstat:
A.gitignore | 1+
ALICENSE | 21+++++++++++++++++++++
AMakefile | 9+++++++++
AREADME | 40++++++++++++++++++++++++++++++++++++++++
Mblag.c | 24------------------------
5 files changed, 71 insertions(+), 24 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1 @@ +blag diff --git a/LICENSE b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021, Alex Karle <alex@alexkarle.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile @@ -0,0 +1,9 @@ +# blag makefile +CFLAGS = -g -O2 -Wall -Wpedantic -Wextra + +blag: blag.c + $(CC) $(CFLAGS) -o $@ blag.c + +.PHONY: clean +clean: + rm -f blag diff --git a/README b/README @@ -0,0 +1,40 @@ +# blag + +> "because markdown isn't in base!" +> ~akarle + +## Description + +blag 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! + +## Usage + +`blag` 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; blag < 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: [https://alexkarle.com my site] or [https://alexkarle.com] + +## TODO + +- Mixed lists +- Lots of code cleanup +- Error reporting on malformed blocks +- Tests diff --git a/blag.c b/blag.c @@ -3,30 +3,6 @@ * ~akarle, MIT License * * "because markdown isn't in base!" - * - * Support: - * -------- - * #|##|### headers - * - * <p> tags around paragraphs - * - * - bullets, breaks allowed if indented - * - * 1. numerical lists, breaks allowed if indented - * - * > quotes - * - * TAB code blocks - * - * Inline `code`, _italics_, and *bold* - * - * Escaping via \ - * - * Links: [url desc] or [url] - * - * TODO: - * ----- - * - error reporting for malformed blocks */ #include <stdio.h> #include <err.h>