Commit Graph

435 Commits (master)

Author SHA1 Message Date
Brian Goff 539b27a624 Add titleblock support 2014-08-04 14:08:22 -04:00
Vytautas Šaltenis 8b4c144eda Merge pull request #95 from anonx/master
Whitelisted th and td to fix #79
2014-07-22 17:00:57 +03:00
anonx 86bc6131df Whitelisted th and td to fix #79 2014-07-22 19:34:23 +06:00
Vytautas Šaltenis c7617b05ad Merge pull request #93 from shurcooL/patch-1
Add a reference to github_flavored_markdown in README.
2014-07-09 16:25:33 +03:00
Dmitri Shuralyov 51cf25db16 Add a reference to github_flavored_markdown in README. 2014-07-04 18:10:34 -07:00
Vytautas Šaltenis 7680f7fdeb Merge pull request #88 from dimfeld/master
Remove unnecessary HTML_ABSOLUTE_LINKS flag
2014-05-30 10:30:05 +03:00
Daniel Imfeld 5bf00efe39 Remove unnecessary HTML_ABSOLUTE_LINKS flag 2014-05-29 09:17:20 -05:00
Vytautas Šaltenis 3c2ae1d185 Merge pull request #86 from dimfeld/master
Add absolute link transformation and footnote enhancements
2014-05-29 16:13:04 +03:00
Daniel Imfeld 10f1dc6358 Fix spelling error 2014-05-28 23:52:45 -05:00
Daniel Imfeld 4ccf982a9e Add tests for absolute prefix 2014-05-25 13:22:33 -05:00
Daniel Imfeld 2ce0592896 Add tests for new footnote functionality 2014-05-25 13:07:05 -05:00
Daniel Imfeld 628c02d37b Move footnote prefix to a better place 2014-05-24 14:28:37 -05:00
Daniel Imfeld c7f4b178c2 Use parameters object for extra options. Enhance footnote support.
Option to add return links.
Option to make footnote prefixes unique, for rendering multiple
documents per page.
2014-05-24 13:29:39 -05:00
Daniel Imfeld ec41294bc4 Add footnote prefix option. Needs testing 2014-05-24 02:55:13 -05:00
Daniel Imfeld 5c12499aa1 Add ability to convert relative links to absolute 2014-05-18 01:28:15 -05:00
Vytautas Šaltenis 03a690ac55 Merge pull request #82 from dimfeld/master
Sanitize shouldn't filter out URLs without protocol.
2014-05-16 12:10:22 +03:00
Daniel Imfeld e10ba88263 Sanitize shouldn't filter out URLs without protocol. 2014-05-16 03:28:44 -05:00
Russ Ross 93aad334f4 Update README.md
link to markdownfmt, add note about LaTeX output
2014-05-14 13:27:37 -06:00
Vytautas Šaltenis bb14a3f92a Merge pull request #78 from JeffPaine/patch-1
Add Usage heading to README
2014-05-09 11:07:21 +03:00
Jeff Paine d55bbf4b7b Add Usage heading 2014-05-08 18:42:05 -04:00
Vytautas Šaltenis f3ab1849e6 Merge pull request #39 from athom/tilde-escape
allow \~ to escape as ~
2014-05-03 16:01:58 +03:00
Vytautas Šaltenis b782052119 Merge pull request #77 from mprobst/cleanup_sanitize_test
Move sanitization tests into their own file.
2014-05-03 15:41:56 +03:00
Martin Probst 7daa6e8b70 Move sanitization tests into their own file.
Also adds an explicit test for [link](...) syntax to be sanitized.
2014-05-03 14:37:23 +02:00
Vytautas Šaltenis 7b5191107e Merge pull request #73 from johnsto/bugfix/fenced-code-append
Fix fenced code extension modifying data beyond slice
2014-05-03 15:15:44 +03:00
Vytautas Šaltenis 717a976f69 Merge pull request #76 from mprobst/self-closing
feat: Write self-closing tags with a />
2014-05-03 15:11:53 +03:00
Vytautas Šaltenis 643477a051 Merge pull request #75 from mprobst/sanitize_test
Avoid raw mode parsing so that tags like <script> don't cause escaping
2014-05-03 15:11:41 +03:00
Martin Probst 55d8f72dde feat: Write self-closing tags with a />
Adds tests for self-closing tags both for correct writing and for correct
sanitization, i.e. stripping attributes on them.
2014-05-03 13:59:10 +02:00
Martin Probst 11e042f6c1 Avoid raw mode parsing so that raw mode tags like <script> don't cause issues.
Certain tags like <script> but also <title> and others switch an HTML5 parser
into raw mode, which causes the rest of the HTML string to be always parsed as
text, including any elements or entities that we do want to support (e.g. <p>).

As we're going to escape any of the raw text elements anyway (it's e.g. script,
style, title, xmp, noframes, and a couple of others) we can just switch of raw
text parsing by disabling it after each starting tag.
2014-05-03 13:26:52 +02:00
Vytautas Šaltenis 50b8e0370b Merge pull request #74 from mprobst/sanitize_test
Add a test for the correct handling of escaped entities in HTML.
2014-05-03 13:58:03 +03:00
Martin Probst 915f7049a0 Add a test for the correct handling of escaped entities in HTML.
The sanitization code does not retain any particular escaped entities - it
parses the HTML and thus loses the information on what entities were in the
original. The result is correct UTF-8 HTML though.
2014-05-03 12:34:16 +02:00
Dave Johnston baebdee6de Avoid double alloc 2014-05-03 08:52:18 +01:00
Dave Johnston 852c1967b9 Fix fenced code extn modifying data beyond slice 2014-05-02 23:05:06 +01:00
Vytautas Šaltenis c76eb63418 Merge pull request #71 from mprobst/master
Add support for a bunch more safe HTML element tags, and bring them into...
2014-05-02 00:55:47 +03:00
Martin Probst 8d2af3a21b Add support for a bunch more safe HTML element tags, and bring them into some order. 2014-05-01 22:08:32 +02:00
Vytautas Šaltenis aeb569ff46 Merge pull request #70 from mprobst/master
fix: Handle all different token types that the parser can emit (d'oh).
2014-05-01 21:59:07 +03:00
Martin Probst f9b7593e65 fix: Handle all different token types that the parser can emit (d'oh). 2014-05-01 20:55:53 +02:00
Vytautas Šaltenis 60ba757eaa Merge branch 'gihnius-master' 2014-05-01 21:46:51 +03:00
Vytautas Šaltenis 3dba5bc56e Merge branch 'master' of github.com:gihnius/blackfriday into gihnius-master
Conflicts:
	html.go
	inline_test.go
2014-05-01 21:43:42 +03:00
Vytautas Šaltenis b44be78459 Allow rel attribute in sanitizer
Fixes issue #68.
2014-05-01 20:49:49 +03:00
Vytautas Šaltenis b54984b711 Merge pull request #69 from mprobst/master
Use go.net/html's parser to sanitize HTML.
2014-05-01 20:47:17 +03:00
Martin Probst 41251715ad Use go.net/html's parser to sanitize HTML.
Use an HTML5 compliant parser that interprets HTML as a browser would to parse
the Markdown result and then sanitize based on the result.
Escape unrecognized and disallowed HTML in the result.
Currently works with a hard coded whitelist of safe HTML tags and attributes.
2014-04-27 23:40:44 +02:00
Vytautas Šaltenis 3ca168f879 Merge pull request #64 from willnix/master
Add table tags to the whitelist.
2014-04-20 23:15:54 +03:00
willnix be9cbc634a tagWhitelist allows alignment attribute now
This is the closest I could get to removing everything "unsave" without introducing an additional regex.
2014-04-19 21:59:04 +00:00
willnix c1e4996787 Add table tags to the whitelist.
Fixing:
55cd82008e

This commit introduced a html tag whitelist which does not include any table tags (<td>,<tr>,<thead>...). Therefore even tables the markdown parser itself generated will be removed.
2014-04-17 15:44:40 +00:00
Vytautas Šaltenis 9c7cf8b1b7 Merge pull request #61 from shurcooL/feature/dont-expand-tabs-inside-fenced-code-blocks
Don't expand tabs inside fenced code blocks.
2014-04-13 10:56:02 +03:00
Dmitri Shuralyov ad246ef7a5 Don't expand tabs inside fenced code blocks.
Still do normalize newlines inside fenced code blocks.
2014-04-12 14:45:25 -07:00
Vytautas Šaltenis 5bcdd5eb7f Merge pull request #60 from shurcooL/fix/fenced-code-block-extra-newline
Fix for potential extra newline added inside fenced code blocks.
2014-04-12 21:58:08 +03:00
Dmitri Shuralyov 8df342acd5 Fix bug where newlines were inserted inside fenced code blocks.
Change firstPass() code that checks for fenced code blocks to check all
of them and properly keep track of lastFencedCodeBlockEnd.
This way, it won't misinterpret the end of a fenced code block as a
beginning of a new one.
2014-04-11 21:27:28 -07:00
Dmitri Shuralyov ef2a2b02dc Add failing test for an issue introduced by PR #56.
The issue is that when there are more than 1 fenced code blocks with a
blank line before and after, the parser introduces a single extra new
line to all the fenced code blocks except the last one.
2014-04-11 19:54:55 -07:00
Vytautas Šaltenis c5ece173ad Merge pull request #59 from johnsto/master
Header ID specifiers
2014-04-11 21:31:27 +03:00