Commit Graph

68 Commits

Author SHA1 Message Date
Vytautas Šaltenis
2f50a53f8e Rename HTML_SKIP_SCRIPT to HTML_SANITIZE_OUTPUT 2014-01-22 01:23:43 +02:00
Vytautas Šaltenis
55cd82008e Rewrite protection against JavaScript injection
This drops the naive approach at <script> tag stripping and resorts to
full sanitization of html. The general idea (and the regexps) is grabbed
from Stack Exchange's PageDown JavaScript Markdown processor[1]. Like in
PageDown, it's implemented as a separate pass over resulting html.

Includes a metric ton (but not all) of test cases from here[2]. Several
are commented out since they don't pass yet.

Stronger (but still incomplete) fix for #11.

[1] http://code.google.com/p/pagedown/wiki/PageDown
[2] https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
2014-01-22 01:14:35 +02:00
David Kitchen
6e6572e913 Added th to table headers so that styling with things like Twitter Bootstrap and typeset.css work as expected. Cells in headers should always be TH unless they are advisory cells within headers in which case TD is acceptable (but being Markdown a user with such needs could just enter HTML for this) 2013-10-16 11:36:33 +01:00
athom
31798e0eab add testcase for GFM autolink 2013-08-09 17:24:26 +08:00
athom
8751c35d1a add EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK flag to make it closer to GFM(Github flavor Markdown) 2013-07-30 10:32:11 +08:00
moshee
3ea84a5811 parser no longer returns prematurely from empty footnote ref 2013-07-08 22:34:12 +00:00
moshee
4513607d62 leftover debug stuff 2013-07-08 09:42:29 +00:00
moshee
1a73bae554 added slice bounds check 2013-07-08 06:54:25 +00:00
moshee
c23099e5ee Implementation and some tests for inline footnotes. Also I noticed the list items had the wrong ids, that was silly of me. 2013-07-01 01:37:52 +00:00
moshee
7bdb82c53a new tests pass but old tests now fail... 2013-06-26 15:57:51 +00:00
moshee
be082a1ef2 First attempt at supporting Pandoc-style footnotes. The existing tests have not broken but the new functionality does not work yet. 2013-06-25 01:18:47 +00:00
Vytautas Šaltenis
079a55851d Fix typo 2013-04-14 01:44:18 +03:00
Vytautas Šaltenis
375cae5dbe Add HTML_SKIP_SCRIPT to MarkdownCommon 2013-04-14 01:43:21 +03:00
moshee
e69cdde766 Add some HTML5 2012-10-21 21:28:31 -07:00
Russ Ross
a5441fd99f updates for go 1 2012-03-07 21:36:31 -07:00
Russ Ross
6bc8c7a22b version bump to v1.1 2011-09-26 15:45:49 -06:00
Russ Ross
fbbd3248e9 tag as version 1.0 2011-07-19 11:42:24 -06:00
Russ Ross
530123dd9f additional doc comments 2011-07-07 12:05:29 -06:00
Russ Ross
bb8ee591d1 doc improvements, commenting 2011-07-07 11:56:45 -06:00
Russ Ross
2b87b0e786 simplify naming of parsing functions 2011-07-05 14:22:21 -06:00
Russ Ross
e35b4b66cc bounds checking stress tests 2011-07-03 10:51:07 -06:00
Russ Ross
689f6cb79b more consistent spacing of block-level elements 2011-07-01 11:19:42 -06:00
Russ Ross
a99c922b84 remove NO_EXPAND_TABS options 2011-07-01 09:57:11 -06:00
Russ Ross
2aca667078 simplify inline callback interface 2011-06-29 13:00:54 -06:00
Russ Ross
8b9cd447d7 version bump to 0.6 2011-06-29 11:22:20 -06:00
Russ Ross
70c92fefd4 inline helpers put parser arg first 2011-06-29 11:21:46 -06:00
Russ Ross
3c6f18afc7 Renderer is now an interface 2011-06-29 11:13:17 -06:00
Russ Ross
873a60ad49 complete page rendering is now an option in the library 2011-06-29 10:08:56 -06:00
Russ Ross
b1a0318250 refactoring: inline renderers return bools, preparing rendering struct to become an interface 2011-06-28 19:46:35 -06:00
Russ Ross
f0cd9a420e render -> Parser, made parsing functions methods of *Parser 2011-06-28 18:58:53 -06:00
Russ Ross
55cde00c8a camel case 2011-06-28 16:02:12 -06:00
Russ Ross
c969dff782 added simplified interface for common usage 2011-06-28 15:55:27 -06:00
Russ Ross
fde2c60665 version number, few more options for command-line tool 2011-06-28 11:30:10 -06:00
Russ Ross
2a18706ca4 options to supress tab expansion or to expand tabs to 8 spaces instead of 4 2011-06-28 10:58:10 -06:00
Russ Ross
f8f70572a4 simplified BSD license 2011-06-27 20:11:32 -06:00
Russ Ross
e22e43bf76 eliminate a buffering level for paragraphs 2011-06-26 17:21:11 -06:00
Russ Ross
ea3d80e2d0 clean up main markdown function: split out first and second passes 2011-06-26 09:51:36 -06:00
Russ Ross
f5e3dc8073 refactoring: newlines as hard breaks changed from HTML option to global markdown option 2011-06-25 15:45:51 -06:00
Russ Ross
eff64c563f reduce copying for lists 2011-06-25 15:02:46 -06:00
Russ Ross
cf97fbd897 experiment: render headers directly to output buffer to avoid a copy; minor speed boost 2011-06-25 08:20:08 -06:00
Russ Ross
f9b03f67fb output validates, command-line tool has useful options 2011-06-24 11:50:03 -06:00
Russ Ross
4b850e8098 tab expansion bug 2011-06-01 18:52:40 -06:00
Russ Ross
9f1d619906 tab expansion fixed to handle multibyte unicode characters 2011-05-31 12:04:58 -06:00
Russ Ross
df64ec5d0f allocate new buffers on stack; mild speed improvement 2011-05-31 11:11:04 -06:00
Russ Ross
9d23b68fa5 export all names from Renderer struct
This enables new back-ends that are not part of the package
Basically a big search-and-replace for this commit
2011-05-30 21:44:52 -06:00
Russ Ross
679e1686db performance fix: with autolinking on, it is almost twice as fast now 2011-05-30 15:36:31 -06:00
Russ Ross
4a17a5b58f remove dependency on less function 2011-05-30 14:42:38 -06:00
Russ Ross
ee3fe99203 rudimentary latex backend, additional cleanup 2011-05-30 11:06:20 -06:00
Russ Ross
81cefb5e7c split parser into multiple files, clean up naming 2011-05-29 17:00:31 -06:00
Russ Ross
4e2d6a50a7 cleanup in markdown: better naming, misc fixes 2011-05-29 11:43:18 -06:00