% Discount -- a C implementation of the Markdown markup language % Jessica L. Parsons (orc@pell.portland.or.us) % # Discount ## Downloads > To build discount, untar your selected tarball, cd into the directory > it creates, then do `configure.sh` to generate your Makefiles. After > doing this, a `make` should give you a functional stack of programs > and libraries. > > Discount builds, for me, on MacOS 10.12, FreeBSD 4.8, NetBSD 8, > Minix 3, and Debian Linux (dunno which version, but it's a `systemd` > joint that’s running a 3.10 kernel.) It may build on SLS Linux and > Windows with mingw, but I'm not sure about that. * [Version 3.0.1.2](discount-3.0.1.2.tar.bz2) There was a decade-old bug in my paranoid malloc where I was using acalloc to grab the raw data buffer for amalloc, thus initializing it to null and hiding a bunch of places where I wasn't null-terminating a string. 3.0.1.2 corrects that, and adds a new #define -- `COMPLETE(x)`, which adds a null terminator to a Cstring -- that I'm using to explicitly null terminate strings instead of `EXPAND(s) = 0; S(s)--;`, which is enough extra code so I might forget it. * [Version 3.0.1.1](discount-3.0.1.1.tar.bz2) And *of course* there were a bunch of new strings that I forgot to terminate in version 3.0.1 ... 3.0.1.1 corrects that defect. Sigh. * [Version 3.0.1](discount-3.0.1.tar.bz2) Whew, where do I begin? * I ran out of slots in the original bitmap flags structure, so I dumped it and replaced it with a new flag blob accessed through a flag pointer. This broke the *entire* [published interface](abbr:API) and required the update to version 3 (this is why it took me over 3 years to implement it; I needed to test the code to within an inch of it's life and between that and transitioning it just ate up time like you wouldn't believe!) * Because I changed the `mkd_flag_t` structure and replaced it with a blob, the old flags are now a pointer and using the `mkd_flag_isset()`, `mkd_set_flag()`, and `mkd_clr_flag()` functions I introduced during the end of the run for version 2.x.x is now *mandatory* unless you're fond of core dumps. * The way I'd originally implemented HTML5 (if that's even a thing anymore?) support was to have a global structure that I allocated once and then you were stuck with it forever (and had to deallocate the structure whenever you stopped using the library otherwise it would leak memory), so I fixed that for v3.0.0 by moving the html5 details inside the MMIOT (activated by setting the flag MKD_HTML5) so it will automatically be deallocated when you are done with a document *without* affecting other MMIOTs. * Github user [mwfont-csl](https://github.com/mwfong-csl) suggested (and provided a patch -- which, alas, I couldn't use because github doesn't seem to have a way to export patches by themselves?) adding support for fractional sizes on images as well as pixels sizes (so, 40%×40% instead of 40x40 pixesl), which I worked into the code using mwfong-csl's original code as a reference. * mwfong-csl *also* provided a patch to do extended attributes on links and image links, via putting those attributes into a `{...}` bracketed block immediately after the link. As before, I couldn't figure out a way to export just a patch from github, so I worked it into the code using their original code as a reference. * Annoyingly, [netbsd11](https://netbsd.org), **broke the implementation of `isspace()`** by putting in a version that dumped core if the input character was outside the ranges of EOF or 0x00..0xff (I deliberately use the word **broken** because it broke the principle of least surprise, which either nobody cares about or is trying maliciously to stop people from using C anymore.) Fortunately could patch around this misbehavior by detecting it in `configure.sh` and telling the compiler (clang and gcc; dunno about other compilers) to make the default character unsigned. * There are also a few of memory leaks remaining, and I fixed a couple of them before this release.. Version 2,x.x releases are still available and can be found in the [archives](v2downloads.html).