This Space for Rent

New Code!

Discount has been pushed, kicking and screaming, up to version 1.4.0, and has been hurled out the door so other people can find bugs in it. Why have I so rudely evicted it from the development machines today? Because I went through and added a handful of new functions to the published interface, and have split and renamed some of the existing functions to try to fit into the grand naming scheme I’m trying to follow.

I’ve not actually taken anything out of the published interface, but I’ve renamed some of the functions (mkd_style, mkd_text) and left the older names merely as #defines.

The new functions are

Allocate a buffer and populate it with the <style> sections found in the code
Write the <style> sections to a file (this is the old mkd_style function)
Process a line of text, then place it into an allocated buffer.
Process a line of text, then write it to a file (this is the old mkd_text function)

An internal function has been pulled out and made into a pair of public functions. I had a private function ___mkd_xml() which someone wanted access to in both write-to-file and write-to-buffer formats, so I expanded it out:

Allocate a buffer, then populate it with an xml'ed version of the input.
Write the xml'ed version of the input string to a file

(the xmlification of a string is simply replacing “>” with “&gt;”, “<” with “&lt;”, “&” with “&amp;”, “"” with “&quot;”, and “'” with “&apos”, plus stripping out all the control characters (0x00-0x1f))

There are also some cleanups in the way I handle utf-8 characters (so that they’re actually handled instead of silently dropped) and I’ve cleaned up some of the documentation to have it not comment on features that vanished in the 0.x era.

So this was enough to bump the version to 1.4.0, and it’s certainly enough to make all the cautions about New Code! extra important. The code works for me (if it didn’t you’d not be seeing this message on tsfr, nor would you see the web page describing the new land mines for you to stumble upon) but if there are any little surprises elsewhere you might find them faster than I will.

So why not download the code, compile it, and see if your workstation will implode, catch fire, or both?