Commit graph

539 commits

Author SHA1 Message Date
Vicent Marti
c059d133d2 Remove superfluous check for tab characters
All tabs are expanded during preprocessing.
2011-09-02 20:57:00 +02:00
Vicent Marti
d7d2af549e UTF-8 handling overhaul
Sundown doesn't handle "strings of characters", it handles buffers
with bytes with an UTF-8 encoding.

Name stuff accordingly.
2011-09-02 20:19:48 +02:00
Vicent Marti
03e8ae0f1d stack: Properly zero-out the stack after reallocations 2011-09-02 04:53:14 +02:00
Vicent Marti
2f473bbe3b ...And the list of HTML block-level tag
This is needed if you want to re-generate the perfect hash.
2011-09-01 06:35:12 +02:00
Vicent Marti
429546d2cd Add missing Stack code
Oops... Forgot about it.
2011-09-01 06:26:30 +02:00
Vicent Marti
b9670c1570 Prefer header lines to item lists
If a line is followed by a header line, do always render it as a header,
even if it begins with a number or slash.
2011-09-01 06:11:33 +02:00
Vicent Marti
c8e42e1eaf Fix #57 "Issue with emphasized links"
The closing character was mismatched.
2011-09-01 05:50:40 +02:00
Vicent Marti
fcfb81f24d Fix #56 "nested strong/em"
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.
2011-09-01 05:43:05 +02:00
Vicent Marti
13359d5898 Create a standalone markdown object
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.
2011-09-01 05:02:26 +02:00
Vicent Marti
fa42843852 Drop dependency on the old array.c
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!
2011-09-01 04:32:38 +02:00
Vicent Marti
9988a0123c Perfect hashing for HTML block names
Because fuck binary searches, that's why.
2011-08-30 17:46:06 +02:00
Greg Leaver
ff2b89be86 Improving TOC nesting. 2011-08-20 13:37:51 +02:00
Vicent Marti
a40cdb9ece smartypants: Add escaping support 2011-08-09 16:59:04 -07:00
Vicent Marti
3753d53fbc Add -fPIC for compiling 2011-08-09 14:28:38 -07:00
Vicent Marti
714348714d Cleanup table parsing 2011-08-08 21:11:42 -07:00
Neil Williams
6cfe32ade8 Use <th> for table header cells. 2011-08-08 20:57:35 -07:00
Vicent Martí
bf369cb00f Merge pull request #54 from spladug/entities
Entity-escape link hrefs.
2011-08-08 19:54:31 -07:00
Vicent Marti
a0b0a11d0e markdown: Fix codespan skip
Backport from Upskirt. Thanks Natacha!
2011-08-08 12:35:50 -07:00
Vicent Martí
03d2e3efa3 Merge pull request #52 from spladug/safelink_segfault
Fix segfault doing SAFELINK check on empty links during HTML render.
2011-08-08 11:40:53 -07:00
Neil Williams
3014d5d317 Entity-escape link hrefs. 2011-08-08 09:51:59 -07:00
Neil Williams
60b2f3b510 Fix segfault doing SAFELINK check on empty links. 2011-08-07 21:57:08 -07:00
Vicent Marti
dd979be0ed Experimental: New Renderer management
No more dynamic allocation. Explicit is better than implicit.
2011-08-04 16:22:38 +02:00
Vicent Marti
e07028b856 Experimental: Custom allocation of the HTML renderer 2011-08-04 13:14:59 +02:00
Vicent Martí
67d7a1f377 Merge pull request #51 from spladug/gitignore
Update .gitignore for the upskirt -> sundown name change.
2011-08-03 14:32:54 -07:00
Neil Williams
ecd06d017b Update .gitignore for upskirt -> sundown. 2011-08-03 10:00:48 -07:00
Vicent Marti
bebbebfc87 html: Revert "do not render line breaks between HTML tags"
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.
2011-08-01 16:03:32 +02:00
Vicent Marti
6f0b745604 html: More consistent newlines in the HTML output 2011-08-01 15:59:03 +02:00
Vicent Marti
a336c2684e html: Do not force line breaks between HTML tags 2011-08-01 13:35:42 +02:00
Vicent Marti
581ed627d8 Update Binding names in the README 2011-07-29 18:57:10 +02:00
Vicent Marti
1d6f114b86 Sup bro
Add support for the Superscript extension.
2011-07-25 02:15:43 +02:00
Vicent Marti
72c9453882 Merge branch 'master' of github.com:tanoku/sundown 2011-07-24 23:29:23 +02:00
Vicent Martí
170a164b71 Merge pull request #49 from mattsta/master
Fixing a quick compile issue
2011-07-23 14:06:18 -07:00
Matt Stancliff
ce1c48aee6 Fix sdhtml_renderer call
The previous commit changed the function signature
without changing a call to the new function signature.
2011-07-23 11:31:08 -07:00
Vicent Marti
fe9e518b92 html: Add an extra payload to the renderer 2011-07-22 23:57:14 +02:00
Vicent Marti
7455702aaf Fix fwrite warning in sundown.c 2011-07-19 21:55:07 +02:00
Vicent Marti
251d02a260 i += 1 is boring 2011-07-19 21:45:38 +02:00
Vicent Marti
e3e2f5e53d Fix invalid memory read in find_emph_char 2011-07-19 21:44:43 +02:00
Vicent Marti
cdfaee1993 smartypants: Do not replace inside <code> blocks
Following the original Smartypants code, do not do SmartyPants
replacements inside of <code>, <pre>, <kbd> and <script> blocks.
2011-07-19 21:32:14 +02:00
Vicent Marti
7cba7b6ba3 Add figure as block-level tag 2011-07-19 20:45:11 +02:00
Vicent Marti
a580f7b2a0 smartypants: Normalize dash replacement
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.
2011-07-19 19:19:55 +02:00
Vicent Martí
20f58920dc Merge pull request #44 from brandonc/fix-autolink-include-guard
Fix autolink.h include guard
2011-07-19 09:56:15 -07:00
Vicent Martí
525fcd9b62 Merge pull request #40 from jnovinger/master
Mispelling in the first <li> under features
2011-07-19 09:55:34 -07:00
Vicent Martí
8bd7e021cb Merge pull request #42 from brandonc/rename-downblouse
rename downblouse to moonshine
2011-07-19 09:54:43 -07:00
Brandon Croft
3b8605f248 fix autolink.h include guard 2011-07-19 03:29:33 -06:00
Brandon Croft
19f74d98b8 rename downblouse to moonshine 2011-07-19 03:12:50 -06:00
Jason Novinger
1bf5cf0c86 Fixes a mispelling. 2011-07-19 03:03:14 -05:00
Vicent Marti
5d201dbcdc Rename Upskirt to Sundown
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)
2011-07-19 01:10:05 +02:00
Vicent Martí
a87645ed92 Rename Pantyshot to Misaka 2011-07-04 18:22:47 -07:00
Vicent Martí
e1dcd5ddfd Merge pull request #33 from chobie/master
add PHP bindings
2011-06-23 10:08:20 -07:00
Shuhei Tanuma
f12a5c5b22 add PHP bindings 2011-06-24 01:38:03 +09:00