also create the new function `mkd_css()`, which allocates and
populates a string containing the style section. `mkd_style()`
is left published, but as a `#define` pointing to `mkd_generatecss()`
in the language definition at Daringfireball) and add in compatability flags
to programmatically revert back to 1.0 compatability mode for testing
purposes.
The new markdown flag MKD_1_COMPAT turns on trailing space trimming of
the first line of codeblocks, and turns off support for implicit reference
links ([links] rather than [links][]); it is enabled in the `markdown`
program with the flag -f1.0 (-F0x2000)
generate toc to a string. Documented in `markdown.3`
and `mkd-functions.3`, requires a new file (`Csio.c`) that has
functions for writing to a Cstring, requires that some of the
internal functions in `generate.c` be exposed (and renaed to
`__mkd_`*function* to reduce namespace collisions.
The new functions in Csio (particularly `Csprintf()` should make
it easier to convert many of the other "we print to a `FILE*` and
you need to lump it" functions into a pair of "print to a string"
and "print to a file" functions.
by writing compiled output into a token queue, then running
an emphasis maker on that queue. The token queue is an array
of TEXT and EMPHASIS tokens -- `TEXT` being what you'd expect,
and `EMPHASIS` holding counts of consecutive emphasis characters.
It's easier to explain with pretty pictures:
During the process of compiling the string `***HI***`, it gets
broken into five tokens:
1. TEXT `<p>`
2. EMPHASIS `*`3
3. TEXT `HI`
4. EMPHASIS `*`3
5. TEXT `</p>`
and then pasted together into a compiled document. During the
pasting, emphasis tokens are paired with the next matching emphasis
token, then rewritten into two text sections (opens & closes) which
are treated as normal text during the pasting.
The above tokens are processed like so; first to
1. TEXT `<p>`
2. EMPHASIS `*`1 [] [`<strong>`]
3. TEXT `HI`
4. EMPHASIS `*`1 [`</strong>`] []
5. TEXT `</p>`
then to
1. TEXT `<p>`
2. EMPHASIS `*`0 [] [`<strong><em>`]
3. TEXT `HI`
4. EMPHASIS `*`0 [`</em></strong>`] []
5. TEXT `</p>`
which is then concatenated to
<p><strong><em>HI</em></strong></p>
And Bob's your uncle.
add a manpage for new functions, modify the makefile to add
a rule to install example programs (just theme for now) and
modify the manpage installer to add links to mkd-functions(3)