Commit graph

262 commits

Author SHA1 Message Date
Xavier Mendez
e7bbe7b0cb API-v2: Simplify HTML API
- html_renderopts is now private
 - hoedown_html_renderer() allocates options and renderer
 - so does hoedown_html_toc_renderer()
2013-10-06 20:37:14 +02:00
Xavier Mendez
1fd6ccbb72 API-v2: Let hoedown_renderer have a void* opaque...
...instead of passing it as a separate parameter.
2013-10-06 20:26:46 +02:00
Xavier Mendez
6d3acbd672 API-v2: Rename hoedown_callbacks to hoedown_renderer 2013-10-06 16:31:42 +02:00
Devin Torres
f8c7a584f0 All exposed structs are now opaque typedefs 2013-10-02 14:12:16 -05:00
Devin Torres
433fbf073e Future-proof other options being used with the TOC renderer 2013-10-02 14:12:16 -05:00
Devin Torres
8bb78911ab GitHub style TOC anchor refs 2013-10-02 14:12:16 -05:00
Devin Torres
d2989aed0c Release 1.0.2 2013-10-02 14:12:16 -05:00
Devin Torres
78f042d990 Fix hoedown_buffer_printf on MSVC
Apparently "vsnprintf is included for compliance to the ANSI standard"
doesn't actually mean it's ANSI compliant.

Closes #21.
2013-09-30 20:29:27 -05:00
Devin Torres
3d9ca45d67 Add TOC nesting level option to hoedown_html_renderer
Closes #19.
2013-09-30 19:30:52 -05:00
Devin Torres
5c862b0615 Improve MSVC support
Closes #18.
2013-09-27 17:53:14 -05:00
Devin Torres
09457e2760 Release 1.0.1 2013-09-25 20:06:52 -05:00
Devin Torres
92948cc1b9 Fix bug rendering footnotes 2013-09-25 20:04:10 -05:00
Devin Torres
390dbc1dac Release 1.0.0 2013-09-25 09:12:33 -05:00
Devin Torres
2c95da1d7a More cleanup and API coalescing 2013-09-23 19:35:54 -05:00
Devin Torres
7c69ce64e3 Fix possible calloc of 0 2013-09-23 18:27:39 -05:00
Devin Torres
eae29db5db Resolve conflict 2013-09-22 04:18:30 -05:00
Devin Torres
8a28f5b58e Fix building with MingW and MSVC 2013-09-22 04:10:51 -05:00
Xavier Mendez
539429545b API: let's stick to *_new 2013-09-21 12:06:42 +02:00
Xavier Mendez
9af2b5587e API: let's stick to is_* 2013-09-21 11:24:30 +02:00
Xavier Mendez
e2cfbdc2e9 Merge latest changes from @devinus into misc-reorganize 2013-09-21 10:12:28 +02:00
Devin Torres
2508c4b5c7 Improvements to the gperf flow 2013-09-20 21:57:08 -05:00
Devin Torres
f7721a652e Optimizations from Houdini 2013-09-20 19:07:46 -05:00
Xavier Mendez
9503af51fb BEHOLD! The BUF ones had the same luck! 2013-09-20 22:10:56 +02:00
Xavier Mendez
241c2fb5f3 BEHOLD! Their HTML_ brothers followed! 2013-09-20 22:06:24 +02:00
Xavier Mendez
2bb26718f0 BEHOLD! The MKD enums are now HOEDOWN ones. 2013-09-20 21:39:56 +02:00
Xavier Mendez
1de960a54a General cleanup on file endings 2013-09-20 19:07:30 +02:00
Xavier Mendez
0b65d27616 Reset version to 0.0.1 2013-09-20 18:46:49 +02:00
Xavier Mendez
7c583492aa Regularize #includes at source files 2013-09-20 18:45:19 +02:00
Xavier Mendez
df6bb7a219 Make headers consistent (comments, guard names) 2013-09-20 18:04:07 +02:00
Devin Torres
189b325f19 Begin code reorganization 2013-09-20 01:14:14 -05:00
Devin Torres
d5675487a5 find_block_tag: Use faster switch statement over an array lookup 2013-09-20 00:02:43 -05:00
Rick Bradley
67bbf3220e ':' is now considered a trailing punctuation 2013-09-19 17:37:57 -05:00
Anatol Broder
78d6c63d68 Option to replace quotation marks with <q> 2013-09-19 17:00:00 -05:00
Yukinari Toyota
48bba3aca1 Set SD_AUTOLINK_SHORT_DOMAINS flag always on 2013-09-19 16:09:53 -05:00
Sami A
abf9198169 Output <hr/> for footnotes when using XHTML renderer 2013-09-19 15:57:03 -05:00
Sami A
71af174519 Fix footnote parsing
Consecutive footnotes do not need to be surrounded by blank lines,
courtesy of @microjo. For example, this is now possible:

[^1]: footnote1
[^2]: footnote2
2013-09-19 15:27:31 -05:00
Robin Dupret
d3aaea3300 Make emphasis wrapped inside parenthesis parsed
Previously, when an emphasis was put inside parenthesis, the option
no_intra_emphasis return it as is. This commit fixes this issue. It
is a redundant issue in tutorials or in readme files.
2013-09-19 15:15:55 -05:00
Robin Dupret
08bc43b657 Fix FTP uris identified as emails
Ensure FTP uris are correctly parsed and not considered as an email
address.
2013-09-19 15:12:41 -05:00
Sam Soffes
0bb213e183 Optional highlight support 2013-09-19 15:10:24 -05:00
Matt Rogers
2e9301b116 Ensure nested parenthesis are handled into links
Make sure that parenthesis inside the link's url are correctly parsed
Redcarpet considered the first ")" occurrence as the link's end so we
first count the number of open "(" and decrement this number each
time we found a ")".
2013-09-19 14:57:30 -05:00
Matt Rogers
7f7d90ded1 Ensure code spans put in emphasis work correctly
When putting code span into simple or double emphasis, we've got an
unexpected output. This commit fix this problem simply removing an
ignore statement about back ticks in the find_emph_char function
2013-09-19 14:52:57 -05:00
Sam Soffes
2bc4d16695 Add optional underline support
This is `*italic*` and this is `_underline_` when enabled.
2013-09-19 12:32:30 -05:00
Dmitriy Kiriyenko
d32be1c697 Add option to ignore usual indented code blocks
Markdown converts text with four spaces at the front of each line to
code blocks. Of course we should support that, but when using fenced
code blocks, indented one can even be harmful. There should be a way to
turn them off.

This patch adds option to disable indented code blocks.
2013-09-19 11:37:20 -05:00
Matt Rogers
9d39c07cb4 Remove unused C macros 2013-09-19 11:25:36 -05:00
Ryan McGeary
89c73d27bf Added support for org-table syntax
This just adds support for using a plus (+) as an intersection character
instead of requiring pipes (|). The emacs org-mode table syntax
automatically manages ascii tables, but uses pluses for line
intersections.
2013-09-19 11:09:14 -05:00
Mike Morearty
8d30051774 Fix SmartyPants handling of single quotes 2013-09-19 11:04:33 -05:00
Ben Dolman
0f1b2a017f Add MultiMarkdown footnotes extension 2013-09-18 17:22:09 -05:00
Vicent Marti
fc97fc37de Always verify the end of a domain 2012-10-22 17:34:12 +02:00
Vicent Marti
bc68d59041 Gah. Stupid typo. 2012-10-19 18:13:51 +02:00
Vicent Marti
0e7d0cc653 Better NO_INTRA_EMPHASIS logic 2012-10-11 13:25:03 +02:00
Vicent Marti
2bb12820b1 Better name for the offset args 2012-10-10 15:41:21 +02:00
Vicent Marti
11d2add5b4 Bring back changes from Rinku 2012-07-08 14:42:26 +02:00
Chris
940612e6cb BUG FIX: va_list handling for visual studio fixed 2012-05-02 21:22:50 +02:00
Vicent Martí
e0f0d88bc3 Fix segfault when parsing syntax 2012-04-22 15:02:45 -07:00
Vicent Martí
3027e7ab3f Fix infinite loop when parsing strikethroughs 2012-04-13 01:30:48 +02:00
Vicent Martí
5c64c8ba7c Properly identify opening code fences 2012-04-12 18:08:37 +02:00
Vicent Martí
eddaf2b87d Oops 2012-04-12 16:41:33 +02:00
Vicent Martí
634f45badd Bump version number 2012-04-12 16:31:44 +02:00
Vicent Martí
2607a45c03 Fix the extensions enum 2012-04-12 15:33:28 +02:00
Vicent Martí
38261808f9 Add MKDEXT_LAX_SPACING extension 2012-04-12 06:27:42 +02:00
Vicent Martí
0e1cb2b157 Improve parsing of continuous list items
- Code blocks nested inside of lists won't be checked
for line starts

- The minimal indentation to continue a multi-paragraph list
has been reduced to 1 space, instead of 4. This is not what the standard
says, but what the Markdown.PL does.
2012-04-12 05:34:51 +02:00
JJ Allaire
ea1b87928c add extern C declaration when using c++ compiler 2012-04-04 15:15:29 -04:00
Vicent Martí
12cdf8e612 Properly check for closing HTML blocks 2012-03-29 02:22:11 +02:00
Vicent Martí
4c43f75a62 Fix blockquotes nested inside of paragraphs 2012-03-29 01:29:30 +02:00
Sebastien Rombauts
37712fd083 Fix for building with Visual Studio 2008 Express
Correct the following link errors:
markdown.obj : error LNK2019: unresolved external symbol _strncasecmp referenced in function _find_block_tag
autolink.obj : error LNK2001: unresolved external symbol _strncasecmp
html_smartypants.obj : error LNK2019: unresolved external symbol _snprintf referenced in function _smartypants_quotes

I needed to add 1 define in 3 files, betweend #if defined(_WIN32) guards :
- #define strncasecmp _strnicmp
- #define snprintf _snprintf
2012-03-25 14:57:52 +02:00
Vicent Martí
3361ebcd22 Fix #91: hanging whitespace breaks tables 2012-02-20 21:17:25 +01:00
Vicent Martí
1c2ac9e094 Fix segfault on empty link refs 2012-02-05 18:05:34 +01:00
Andre D
05f958dae6 Require a space for link titles 2012-01-27 11:47:24 -05:00
Andre D
b8be4a8a35 Escaping will not happen if the escape character is at the end 2012-01-25 15:08:11 -05:00
Vicent Martí
519e355637 Skip UTF-8 BOM at the start of the document 2011-12-21 01:49:31 +01:00
Vicent Marti
bf1e52520e Silence x64 warnings 2011-12-13 19:08:53 +01:00
Vicent Marti
e1a838a764 Cleanup the buffer code
Asserted stuff should be asserted.
2011-12-13 19:01:30 +01:00
Vicent Marti
63d995158e Fix autolinks that end in a period 2011-12-03 23:41:34 +01:00
Vicent Marti
e81f7485f9 Fix off-by-one with backticks and emphasis
...well that was easy
2011-12-03 23:18:21 +01:00
Vicent Marti
a20ff08f6c Change include wards 2011-11-26 07:06:50 +01:00
Vicent Marti
c5eb872e97 Backport the changes to autolinking URLs by @codyrobbins 2011-11-26 07:00:43 +01:00
Vicent Martí
187444d917 Merge pull request #83 from cweider/master
Exclude <style> blocks from replacement
2011-11-25 21:56:06 -08:00
Vicent Martí
be410f637d Merge pull request #82 from andre-d/linktextfix
Corrected the way link alt text is handled
2011-11-25 21:54:59 -08:00
Vicent Marti
54523fc7db Initialize the in_link_body variable 2011-11-26 06:53:52 +01:00
Chad Weider
d976a845ad Commit compiled code. 2011-11-25 13:51:55 -08:00
Andre D
7b42d86de0 Corrected the way link alt text is handled 2011-11-22 22:04:14 -05:00
Andre D
6cbb0c9995 Nesting lists of different types works again 2011-11-21 14:43:02 -05:00
Vicent Martí
d2d3c533a9 Merge pull request #80 from andre-d/master
Fixes corruption with vbufprintf
2011-11-17 19:29:10 -08:00
Vicent Marti
9dfeea9da1 Backport changes from Snudown
Add escaping to ~ and ^, and disable autolinking inside of link bodies.
Note that the fix for autolinking is different than the one in Snudown;
I didn't want to touch the callbacks table.
2011-11-18 04:17:19 +01:00
Vicent Marti
3c32220c7b Fix unordered lists followed by ordered list bug
"An unordered list followed by an ordered list (separated by double
linebreake) yields only an unordered list with a set of paragraphs
inside it."

Original patch by Igor Bochkariov, backported from Redcarpet.
2011-11-06 21:21:06 +01:00
Andre D
86b851a55b Corruption in vbufprintf 2011-11-01 18:02:00 -04:00
Neil Williams
720ff71578 Make sure www-autolink text is entity-escaped.
rndr_link assumes the text is already escaped because
it's usually run through parse_inline. This is not true
when it's called via www-autolink.
2011-09-15 20:58:20 -07:00
Vicent Marti
137c1e6f20 Fix table cells being rendered as table headers 2011-09-13 19:44:40 +02:00
Vicent Marti
3cb0b6873a Locate block tags even if they have attributes
Previously, block tags like <div>foo</div> were being properly detected,
but tags with attributes such as <div class="blank">foo</div> were
inproperly discarded.
2011-09-13 19:26:59 +02:00
Vicent Marti
47c25422f1 Fix detection of block tags 2011-09-08 23:03:39 +02:00
Vicent Marti
9970b3da05 Fix out of bounds in stack 2011-09-08 06:41:57 +02:00
brief
78a764317b Use explicit cast to fix compiler warning 2011-09-03 14:34:03 -07:00
brief
97da8f23da Enforce const when parsing emphasis 2011-09-03 14:21:58 -07:00
Vicent Marti
63b1a9ebcf Enforce const on the renderer API 2011-09-02 23:40:21 +02:00
Vicent Marti
c650128164 Remove ref counting from the buffer struct 2011-09-02 23:33:59 +02:00
Vicent Marti
b8ed678a98 Enforce const on input document 2011-09-02 21:28:47 +02:00
Vicent Marti
6091758705 Do not use a local-aware isspace
It may conflict with UTF-8 characters in the extended range.
2011-09-02 21:12:45 +02:00
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
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
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 Marti
a0b0a11d0e markdown: Fix codespan skip
Backport from Upskirt. Thanks Natacha!
2011-08-08 12:35:50 -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
1d6f114b86 Sup bro
Add support for the Superscript extension.
2011-07-25 02:15:43 +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
Brandon Croft
3b8605f248 fix autolink.h include guard 2011-07-19 03:29:33 -06: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 Marti
3b0a641094 Dashes are allowed in domain names! 2011-06-19 20:58:36 +02:00
Vicent Marti
76fd65c396 autolink: Better domain name checker 2011-06-11 16:18:18 +02:00
Vicent Marti
cf5cb52ae9 Remove html_autolink.c
This file has been moved to Rinku
2011-06-11 16:17:51 +02:00
Vicent Marti
b3957282ce autolink: Cleanup API 2011-06-09 02:58:06 +02:00
Vicent Marti
8af37fd1b4 autolinking: fix bugs 2011-06-08 23:11:58 +02:00
Vicent Marti
cbb7fb53c6 Create an autolinking API for external applications 2011-06-08 18:30:37 +02:00
Vicent Marti
79e9a7ac36 More strict email autolinking 2011-06-02 23:54:52 +02:00
Vicent Marti
c631d97c11 Fix delimiter parsing in autolinking 2011-06-02 22:52:49 +02:00
Vicent Marti
268e9b411b Autolinking bonanza
This autolinker is not only twice as fast, it also passes the Rails
autolinking test suite. Supports email addresses and autolinks without
`http://` prefix.
2011-06-02 21:17:28 +02:00
Krzysztof Kowalczyk
22ccf400a9 msvc fixes 2011-06-01 19:30:19 +02:00
Krzysztof Kowalczyk
7b56710f80 spelling fixes in comments 2011-06-01 19:29:54 +02:00
Vicent Marti
b1450fdf8f Escape only the characters defined by the standard
ROCK ON MOTHERFUCKERS \m/
2011-05-20 03:57:30 +03:00
Vicent Marti
f20823e175 Even smarter autolink matching 2011-05-18 22:16:13 +03:00
Vicent Marti
2275e90888 Bump version number 2011-05-17 15:32:55 +03:00
Vicent Marti
0d26f74fba Match version number with Redcarpet's 2011-05-17 15:32:00 +03:00
Vicent Marti
29e4c66e90 Fix numbers in email links
Never forget about <133h4x0r69@hotmail.com> and the likes.
2011-05-17 15:32:00 +03:00
Vicent Marti
fb517dcabf Add support for versioning 2011-05-11 20:07:28 +03:00
Vicent Marti
cf81b53ee8 Do not call bufgrow unless necessary 2011-05-07 21:24:38 +03:00
Vicent Marti
a8cb69438c Add MKDEXT_SPACE_HEADERS extension 2011-05-06 22:28:47 +03:00
Vicent Marti
7cb1a9e027 Do not inline bufgrow() and bufput()
These two methods are no longer used by the SmartyPants parser, so
there's no performance benefit when inlining them.

This reverts commit 8a19bdd635.
2011-05-05 18:30:13 +03:00
Vicent Marti
9fa8438a41 Use a two-layer array for active character callbacks
Do not stick 2KB of NULL values inside the `struct render`, use a double
lookup to character -> ptr. This makes the struct 8 times smaller.
2011-05-05 17:40:04 +03:00
Vicent Marti
35a580ffce More lax support for Table headers
The separation row can now be separated with spaces from the column
borders.
2011-05-03 00:05:24 +03:00
Vicent Marti
bb9dbe8b5f Rename strict emphasis flag again
'Cause I can and I like pretty names
2011-04-30 03:54:29 +03:00
Vicent Marti
d2ffc352f4 More agressive buffer management
Use two different buffer queues for span level and block level
elements, with different step sizes for the buffers in each queue.
2011-04-30 03:40:02 +03:00
Vicent Marti
0d11119240 Always print header and footer
Even on empty Markdown documents
2011-04-30 03:05:24 +03:00
Vicent Marti
daedc8e8ce Much more solid autolinking
We now capture links when enclosed in parenthesis and other punctuation
chars.
2011-04-30 02:18:14 +03:00
Vicent Marti
16b4342f24 Lax emphasis is the default
With no extension flags, Upskirt now matches the behavior of Gruber's
Markdown when parsing emphasis without surrounded spaces.
2011-04-28 13:33:23 +03:00
Vicent Marti
1d84eccd45 Do not segfault when unescaping empty links 2011-04-27 15:18:55 +03:00
Vicent Marti
8f0988ab84 Allow escaping characters inside of URL links 2011-04-27 04:26:42 +03:00
Vicent Marti
018fea055e Fix autolink URI parsing and generation 2011-04-26 00:14:30 +03:00
Ben Noordhuis
8a19bdd635 20-25% of CPU time is spent in bufputc() and bufgrow(). Inline for great performance justice. 2011-04-26 00:14:26 +03:00
Ben Noordhuis
5985563743 Fix memory leaks in bufrelease() and bufreset(). 2011-04-25 02:03:27 +02:00