I don't understand what was that check doing there, but it makes no
sense. Emphasis parsing is non-greedy, so it should always close on the
nearest match.
This was the next logical step on the interface revamp for 2.0.
The old API was doing very fishy stuff with allocation: the `rndr`
struct was being called once for every `sd_markdown` call, and the
amount stack space filled with it was just inappropriate (256 bytes
just from the char table and 300 more from pointers in the callback
table).
By creating the renderer on the heap and reusing it, we save a lot of
time on initialization code, at the expense of not being able to
change the enabled extensions on each parse (something which is not
that common anyway).
This will make wrapping Sundown in higher level languages more direct,
given that every other language has OO design, which maps better to
the concept of a reusable renderer.
The old array was not quite optimal, and was not used optimally either.
- The `struct array` that was used for accessing link references has
been replaced with a minimal, fixed-width hash table. This should
be much more straightforward for small documents.
- The `struct parray` used as a string pool has been replaced with
a fast-growing stack. Realloc'ing once per push has never been a
good idea anyway.
Yey for losing boilerplate!
This was not a good fix. There is plenty of HTML that would have been
parsed unproperly, e.g.
This is a simple example of <em>HTML</em>
that would have not been broken in two lines.
The proper fix is to always print line breaks instead of newlines, and
ensure that Sundown never inserts newlines when rendering span-level
elements, which is the case since the previous commit.
The original SmartyPants comes with three dash replacement modes:
1 => "--" for em-dashes; no en-dash support
2 => "---" for em-dashes; "--" for en-dashes
3 => "--" for em-dashes; "---" for en-dashes
Sundown now runs with number 2, because I am opinionated and I think
that the other 2 options are stupid.
It is by the goodness of God that in our country we have those
three unspeakably precious things:
freedom of speech,
freedom of conscience,
and the prudence never to practice either of them.
-- Mark Twain, Following the Equator (1897)