% Discount -- a C implementation of the Markdown markup language % Jessica L. Parsons (orc@pell.portland.or.us) % # Discount ## Version 2 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 2.2.7d](discount-2.2.7c.tar.bz2) One more maintenance release to fix a few more bugs: * markdown extra footnotes were slightly broken -- two adjacent footnotes (`[^1][^2]`) were being treated as a regular old hyperlink because the code I put in originally was a huge old monster bodge. * change the description for -fstrict. * add a fistful of test cases for the new! improved! Markdown.pl compatible `` * rework the tag handler to more closely adhere to Markdown.pl's observed behavior; also treat incomplete tags as actual tags in compatability mode (-fstrict) * fix weird behavior on freebsd 4.8 w/ gcc 2.95.4; if an #ifdef ... #else ... #endif wraps the end of a `if ()` it pukes up an error about a syntax error in a macro; pull those tests out and conditionally #define a macro instead * the behavior of tags-starting-with-alpha was not like that of the reference implementation; fixed (in a very script-kiddy leaky fashion which I can't resolve with a runtime flag thanks to the 32 bit flags field in the 2.x series :-( * [version 2.2.7b](discount-2.2.7b.tar.bz2) *Another* maintenance release to fix a bug in the Makefile; I didn't have the proper dependencies for the pandoc\_headers tool, so if a parallel make was tried it would fall over complaining about missing objects when it tried to link everything together. * [version 2.2.7](discount-2.2.7.tar.bz2) A maintenance release to clean up a buffer overflow when generating label names (backported from the new v3 under (slow) development) * [version 2.2.6](discount-2.2.6.tar.bz2) should have been released last fall, but I was too busy working on breaking the published interface so I could expand the flag structure to permit more than 32 feature flags. *\*sigh\** It's not a huge release; it fixes a few bugs, tweaks a few things, and adds a couple of features: bugs * deal with cached text before handling fenced code blocks (because otherwise it would accumulate the contents of things between the blocks and spit them out afterwards.) * don't give a code block class if it's just an empty string * mkd2html wasn't passing pgm to hoptusage() * mkd2html wasn't properly handling two arguments for input & output files. While I was at it, add the -G option to use gfm\_in() to read the input file in (and preserve newlines) * push the fencedcode block handler up to the toplevel scanner so it will handle blank lines inside the fence (it's splitting the code block up into paragraphs and treating them as text.) features * add an anchor format callback, plus add the -x option to the markdown program to squash toc anchors to (close to) github compatability * add an external code block formatter to the markdown program * clean up all references to flags; define them EVERYWHERE as `mkd_flag_t` * support external code formatters tweaks * configure to 1. use the modern standard uintXX\_t types for DWORD, WORD, BYTE if possible and 2. if a program is defined via an environment variable (like CC) try to use that variable instead of doing a path search in AC\_PROG * make a test program to examine pandoc header elements * patch the cmakefile so that has an option to only generate a library * set the Plan9 CFLAGS to the two extensions (instead of having them be part of the CC macro) and wipe out any CFLAGS (like -T, which tells the Plan9 posix C compiler to be stupid) that already exists * the Makefile macros a bit so people can wedge in their own compilers (BUILD) and linkers (LINK) during a build * when dumping the parse tree, say which header is being dumped -- h1..h6 vs just header * [version 2.2.4](discount-2.2.4.tar.bz2) fixes a couple of small buglets, adds a couple of new features, and tweaks the html5 support module to chase the html5 standard: 1. (**bugfix**) when splitting a line, null terminate the new line; also don't inherit the dle from the previous line 2. (**bugfix**) fix the broken footnote code; allow multi-paragraph footnotes, not just one line of footnote. 3. (**feature**) support github checkbox list items (static configuration option) 1. `--github-checkbox` does the checkbox with html check entities 2. `--github-checkbox=input` does them with html `` elements (set to disabled so that people can't check and uncheck willy-nilly) 4. (**feature**) on systems that support it, use the "destructor" attribute on `mkd_shlib_destructor()` so it will run automatically when the library unloads. 5. (**feature**) add `--cxx-binding` option to `configure.sh` to generate a `mkdio.h` that’s got an `extern "C"` wrapper around it. 6. (**tweak**)delete `HGROUP` from the list of html5 elements, because the w3c working group decided to [punt it](http://lists.w3.org/Archives/Public/public-html-admin/2013Apr/0003.html) The bugfix for not null-terminating a split line was reported by Github user [fCorleone](https://github.com/fCorleone), who was running a input mangler program ([afl](http://lcamtuf.coredump.cx/afl/)) to stress discount by feeding random garbage to it. It saw that the `splitline()` function (used when breaking out embedded chunks of html) was not null-terminating the split line chunks, and was throwing errors on that. (this is something that `clang` on modern macos catches if you use the `-fsanitize=address` option.) I never actually use footnotes, so I'd been running for about a decade assuming that footnotes were one or maybe two lines, but github user [somasis](https://github.com/somasis) pointed out that this was wrong wrong wrong! Ooops; at least it's fixable w/o much pain and suffering. `HGROUP` was caught by (no longer registered) github user Crypto-Anarchist in their own branch of discount, so I cherry-picked that changeset and pulled it back into the mainline discount. * [version 2.2.3a](discount-2.2.3a.tar.bz2) 2.2.3 has a configuration glitch (not properly testing for the existance of S\_ISSOCK, et seq) which 2.2.3a corrects. I also pulled the plug on the single use of `alloca()` in `theme.c` (Windows MinGW doesn't support it properly(?) and in this one case I'm better off just `malloc()`ing the offending thing and letting it be garbage collected when the program finishes.) * [version 2.2.3](discount-2.2.3.tar.bz2) I turn around and blink, and suddenly 13 months have gone by while I slowly tested various beta versions of 2.2.3, and now it's 2018 and a small collection of cosmetic, portability, and build tweaks, plus some and actually bad bugs have been cleaned up: 1. Have `tools/branch` be a no-op if there’s no git that I can use to check for my SCCS status. 2. Add user-contributed cmake support 3. check for non-null T(link) in the safelink function; rename paranoia.t to safelink.t, add a couple more tests for safelinks 4. tweak the safelink detection code to allow more types of url fragments 5. when finding the installer, check that -s works (doesn't work on Minix 3?) 6. Correct makepage & theme to use the new `set_flag()` return scheme (0==success, !0==pointer to bogus flag) 7. if an unknown flag was in the middle of a comma-delimited flag string (like -flatex,bogus,footnote), the markdown program would incorrectly report the first flag as unknown (because set\_flag returned 0 on error, 1 on success and the strtok() of the flag string had already replaced the commas up to that point with nulls.) Change it so that set\_flag returns null on successful processing and a pointer to the offending flag on an unknown one. 8. Tweak the install rule to install a GNU-style .pc file iff @MK\_PKGCONFIG@ is not defined as # 9. Hand-resolve a conflict in the msvc Makefile 10. Add in paranoid list splitting \[EXPLICITLIST\] (the default behavior many many versions ago before I realized it wasn't the standard) (and take the last of the 32-bit flag mask for it) between adjacent ordered and unordered lists. 11. Create a utility function \[`notspecial()`\] for theme & mkd2html -- check a filename to see if it's a special file that doesn't need to be deleted or to have a .html suffix added to it. It only works on machines that have a stat() system call + the S\_ISFIFO, S\_ISCHR, and S\_ISSOCK macros, otherwise it thinks that nothing is special. 12. Add a README for the utilities in the tools subdirectory 13. Add the git branch name into the version string if we're not on the main branch. 14. Add support for NMAKE and Visual C++ toolset. (courtesy of Martin Hofmann (tin-pot)'s fork of Discount). 15. Add a "dirty" flag to the Document structure & set it whenever a callback changes (github issue #136) so that the next mkd\_compile will regenerate the document. 16. Tweak superscript handling to be able to superscript something wrapped in html 17. Tweak the `show_flags()` function so that if it's called verbosely it will show synonyms for named flags. (Calling it verbosely is done by the `V` option, which is overloaded for verbosity when listing flags.) 18. Process html blocks in compile (as well as in compile\_document(); `compile_document()` needs to handle `