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.
with `-Fxx`, `-fname`, or the environment variable
`MARKDOWN_FLAGS`; this means I needed to split the
options parsing code out of main.c into its own file
that can be included wherever.
compilers (and by some compilers, I mean "gcc") whine bitterly when you pass a
function argument with with a more specific pointer in place of a void*. And if
I can't trust the compiler to emit sensible warnings, I'll just cast the damned
argument to a type that makes it stfu.
In addition, I needed to add prototypes for the html5 tag adder and the two
functions that spit out a list of the flags that the code was compiled with.
(either a flags value (mkd_flags_are) or of an MMIOT (mkd_mmiot_flags))
to a FILE. `markdown -VV` prints out the flags for now, and the
functions are there for other people to use as they desire.
This involves reworking the blocktag[] array into a STRING(), and moving the entire
kit and kaboodle out into a separate file with a public initializer (mkd_prepare_tags),
definer (mkd_define_tag) sort (mkd_sort_tags, and lookup (mkd_search_tags) function.
The html5 tags are further removed into their own function (mkd_with_html5_tags) which
can be included when someone wishes to have html5 support.
Note that html5 support is library-wide; once you call mkd_with_html5_tags, you're
stuck with them everywhere and can't back them out. This might be revisited later,
2. Tweak the paragraph wrapping in `generate()` so that all
paragraphs in a multiple-paragraph item/blockquote will
be properly wrapped with `<p>`...`</p>` (or whatever is
appropriate.)
3. Attempt to follow indentation better inside lists, so
a list item with multiple paragraphs is parsed correctly
when the second (& up) paragraphs are indented the same
as the first paragraph.
1. "autolinks" -- expand unbracketed urls into links
(flag MKD_AUTOLINK, -fautolink in the markdown program)
2. "safe links" -- don't linkify footnotes where the link protocol
isn't a well-known protocol (currently http: https:,ftp:,news:)
(flag MKD_SAFELINK, -fsafelink in the markdown program)
function `mkd_line()` formats a line into a string,
similarly to `mkd_toc()`, `mkd_xml()`, and so on.
There are a whole bunch of new public functions now,
so I'm pushing the version up to 1.4.0
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.
of A^B and non-emphasis on A_B.
2. markdown(1) now has the `strict` (enable `MKD_STRICT`) and `relax` (disable
`MKD_STRICT`) flags.
3. truncate the input buffer at the end of every call to `text()` (corrects
defect with --relaxed-emphasis where it was incorrectly looking back past
the start of the input and triggering on the contents of the previous
input (not reliably, so only detected when I put MKD_STRICT into the
code.)
4. `markdown.1` manpage renamed to `markdown.1.in` and processed according
to whether --relaxed-emphasis and/or --with-superscript are configured.