build: Add support for plan9 It seems that commenting out unistd.h is all thats needed to build with pcc(1). A quick check of big.txt seems to work!
style: Convert whole source to adhere to style(9) The OpenBSD style(9) guide seems as good a guide as any to adhere to, since it's the OS I'm primarily developing on / targetting. The non-curly else-if's after a multi-line if feel a bit weird/unsafe (and I'm a tad surprised they wouldn't suggest always using parens to combat easy mistakes.. I guess that's what compiler warnings are for?). No real functional changes, although I basically get rid of parse() since I realized handlec was basically doing all the heavy lifting...
Add CI via builds.sr.ht The build/test are super fast, but it's good to run them on each push as a sanity check!
Link blog post in SEE ALSO section of man page In case someone wants to see more history :)
Remove old blag name references Somehow these slipped through the rename...
refactor: Replace mini-link state machine with playback mechanism The first implemenation of the link description formatting had a mini- version of the larger state machine in the pushbuf() function, which is a bit of a maintenance burden for future changes that need duplication. This patch removes the need for that mini-state machine clone by refactoring the main loop into its own function that allows for "playback". Certain things are still global of course, but the character being parsed is paramaterized so that we can feed lnkdes[] one char at a time to the buffer!
Fix [url] links with non-space characters after I noticed on my blog that [url]: foo was broken--we need to check for [url] links for all characters, not just whitespace!
Replace home-rolled strcpy with strlcat This reverts commit dcc2b5252bfe66a23571ca003716c68c6715b9f6. The time savings from using a home-rolled strcpy implementation vs strlcat (which is safer both in that I don't need to manipulate pointers AND it handles null termination) are negligible (not observable in 1000 runs). I suppose it might have an impact for super long link descriptions, but I don't expect many of those...
Add experimental home-rolled strcpy in name of performance The previous implemenation of strcat needs to repeatedly (for every character in the lnkdes) go to the end of the lnkdes to append to it. I thought it _might_ be faster to replace it with a persistent pointer to the end of the buf, and it is, so it's worth checking it in, but I'll revert this immediately because the code-clarity ain't worth the speed boost!
Change link syntax to [desc](url) style This is one of those things that I think is just much better looking from the plaintext-source perspective. It's a shame that it's a bit more complex / inefficient (repeatedly strcat-ing instead of printing/saving the characters as they come), but IMHO, it's cleaner: read about [my link](https://alexkarle.com) mid-sentence vs read about [https://alexkarle.com my link] mid-sentence Time to go update my whole site with this syntax. Regex to the rescue!
Document "streaming" nature of parsing
Add support for multi-paragraph blockquotes This was harder than expected--it changes the paradigm of the blockquote being a typical "Block" type, since we need to contain other block types inside it (like paragraphs); instead, it's a new global state boolean, and we use that to determine when to start and end the blockquote.
Rebrand blag -> nihdoc The new name is a play on mdoc(7), jokingly pointing fun at the decision to "invent here" instead of use markdown.
Remove unused import and refactor to remove another Optimizing for size a bit.. definitely over-optimizing at this point, but it's fun!
refactor: Save a few lines here and there A couple of these are dicy in terms of better readability, but the maybe_startp was a good find!
refactor: Convert from singleton state struct -> globals On one hand, globals are considered bad practice. On the other.. using a singleton struct is basically the same thing. Might as well save the argument passing!
refactor: Move CODE/link check into fmt_disabled This just reads better.
Remove escaping of single/double quotes I don't think this is really ever necessary. It would be _in_ the HTML tags, but we don't support that except for in link href's, and there shouldn't be quotes in the URL's anyways :) This just makes the resulting HTML a bit cleaner.
Fix [ in code blocks and further consolidate formats This should make it easier to add ~strikethrough~ and other formats, if desired!
refactor: Use bool's over int's for true/false