New (beta) Code!
Discount has been shoved up to version 2.0.4beta3 with a small collection of bug fixes (most of the bugs were reported by (and most of the chrome was suggested by) Gustavo Lopes as fallout from a project he’s working on that uses a shared library version of discount) and a new feature (code, which I brutally extended to provide MacOS support, provided by David Banks) in the form of shared library support (which I am now using here on gehenna and on my MacOS box.)
There are a bunch of bugfixes here:
- In
mkd_css()
, don’t check that*res
is non-null. - if definition lists are turned off, note that in version.c
- unclosed html & style blocks now revert to being plain old markdown instead of being accepted as unclosed blocks of html or style.
- Add a
mkd_shlib_destructor
function so people who use it as a run-time load(and unload)able shared library can clean up the dynamically allocated html tag list before unloading the library. - repair markdown extra-style dl handling so that skipped blank lines are garbage collected.
- Flip the order of arguments to
fwrite()
insidemkd_generatecss()
; it wassize, 1
(write 1 element size bytes long; fwrite will return 1 or 0) and it should be1, size
so I can get back the number of bytes actually written.
And some chrome:
- Add prototypes for
mkd_initialize()
,mkd_shlib_destructor()
, andmkd_deallocate_tags()
to make gcc stfu. - null terminate the buffers generated by
mkd_css()
,mkd_toc()
, andmkd_line()
(in the same fashion as elsewhere; the null termination is allocated, but the returned size doesn’t count it. This way afwrite()
writes out the proper number of characters, but a naivefputs()
won’t charge off into terra incognito.) - Be more picky about what comes before a superscript “
^
”; alphanumerics plus “)” are good, other nonspace characters are not.
The single feature is that shared libraries (MacOS,
FreeBSD, and Linux only) are now supported
through the --shared
flag to configure.sh
.
It’s a fairly rough implementation – I don’t support versioned shared libraries on FreeBSD or Linux, and only support it via a fairly horrible hack on MacOS – but it does actually work and it allows you to (if you wish) enter the modern world of Unixy DLL hell.
So why not try it? It’s really new, and you can be on the bleeding edge of watching your programs explore the frontiers of software development from the comfort of the edge of your seat.