Commit Graph

449 Commits

Author SHA1 Message Date
Paul Roub
f69a82f7bc Remove redundant cast 2018-03-21 09:23:13 -04:00
Paul Roub
697af11e53 Added integration tests for explicitly-initialized ordered lists.
Fixed a bug in the initial implementation of ordered-list
initialization.

Add a simpler unit test around starting-from-zero.
2018-03-20 17:03:11 -04:00
Paul Roub
6b4f2ffa10 Start ordered lists using the initial numbers from markdown lists
Adds tests for list creation and continuation when starting with a
number other than 1.

Emits 'start' attribute only when necessary; simple cases behave as
always.
2018-03-15 12:56:59 -04:00
Steven
ec78260e11 Fix urls to markedjs 2018-03-03 14:20:24 -05:00
Jamie Davis
b15e42b67c security: fix regexes vulnerable to catastrophic backtracking
Problem:
Four regexes were vulnerable to catastrophic backtracking.
This leaves markdown servers open to a potential REDOS attack.

Solution:
Refactor the regexes.

For two similar regexes (html) I didn't change the language.
For two similar regexes (noline) I slightly changed the language:

![[[[[[[[[[[]] was accepted by the old noline pattern.
It is now rejected.

All tests pass, though I'm not sure if I've broken something that
was untested.

This addresses #1070 (with #1058 along the way).

Bonus: rename a stray test to use _ instead of -.
2018-02-26 21:03:55 -05:00
Federico Soave
55ab987d44
Merge branch 'master' into lint 2018-02-23 19:33:34 +01:00
Tony Brix
9a757fc19e remove parens 2018-02-18 19:32:34 -06:00
Tony Brix
bed875bf46 revert number of capturing parens in #1013
fixes #1059
2018-02-18 19:12:40 -06:00
Federico Soave
ad6484b90c !fixup 565b4a0e5b 2018-02-13 22:09:27 +01:00
Federico Soave
560c5cb13b Merge branch 'master' into lint 2018-01-26 04:57:18 +01:00
Federico Soave
b8437b0742 fix underscore emphasis (apply commonmark flanking rule and rule 12) 2018-01-25 17:10:10 +01:00
kythyria
1c780b9985 Fix the regexes for thematic breaks
Commonmark and GFM both agree that -_- is literal characters, not <hr>,
as all three characters must be the same.

Also change the test harness to only look for .text and .html files
since it was choking on vim's swapfiles.

And add some tests to catch what this fixes.
2018-01-25 17:08:13 +01:00
Josh Bruce
33b444c360
Merge pull request #1033 from Feder1co5oave/quotes_in_titles
Make legacy test literal_quotes_in_titles pass
2018-01-24 19:31:45 -05:00
Federico Soave
fac31ed978 allow matched double quotes in link definition title (markdown.pl behavior).
Test literal_quotes_in_titles now passes.
fixup! c3e00590
2018-01-23 17:03:08 +01:00
Federico Soave
ca455a68de gfm autolinks: backpedal on trailing punctuation
(see https://github.github.com/gfm/#extended-autolink-path-validation)
2018-01-23 16:29:31 +01:00
Federico Soave
187d46f294 email address domain must contain at least a dot and must not end with dash or underscore 2018-01-23 16:29:31 +01:00
Federico Soave
00f1f7a239 new gfm autolink rule: http/www URLs and email addresses 2018-01-23 16:29:31 +01:00
Federico Soave
a8f2d7ff6e new rule for autolinks, adjust html rules accordingly.
test 574 does not pass because of url encoding FIXME)
2018-01-22 19:03:15 +01:00
Cory Forsyth
6d974b1dbf Do not autolink a trailing "!" in a URL
* Expand gfm link tests to include all possible ending punctuation
2018-01-22 19:03:14 +01:00
Josh Bruce
024e378f43
Merge pull request #682 from Feder1co5oave/fix_typeerror
Throw error on non-string input
2018-01-20 17:16:11 -05:00
Josh Bruce
68aab24f7e
Merge pull request #1023 from Feder1co5oave/new_blockquote
[commonmark] Make blockquotes commonmark compliant
2018-01-20 17:14:44 -05:00
Josh Bruce
19f6afe4aa
Merge pull request #456 from Feder1co5oave/clean-segments
IDs of headings with inline tokens (link, em, bold...)
2018-01-20 16:09:27 -05:00
Josh Bruce
a98bad2430
Merge pull request #1013 from Feder1co5oave/fix-backticks2
fix backticks in inline code (replaces #503, fixes #312)
2018-01-20 15:46:19 -05:00
Josh Bruce
a78d51f775
Merge pull request #1014 from AndyLnd/master
chore: remove unused flags variable
2018-01-20 15:38:27 -05:00
Federico Soave
3bbcc885dd [lint] fix already declared/unused variables 2018-01-20 03:21:46 +01:00
Federico Soave
565b4a0e5b [lint] make the outer function a recognizable IIFE 2018-01-20 03:12:08 +01:00
Federico Soave
d9c471e265 [lint] fix var declarations 2018-01-20 03:12:08 +01:00
Federico Soave
1a19028b66 [lint] fix whitespace 2018-01-20 03:12:08 +01:00
Federico Soave
7e1836f547 [lint] add parens to empty constructor calls 2018-01-20 03:12:03 +01:00
Federico Soave
b2edbd6464 [lint] refactor replace() with an OOP approach. ESlint is happier. 2018-01-20 03:11:56 +01:00
Federico Soave
f45dc385d9 match setext headings just before paragraphs, then only paragraph continuations are matched inside blockquotes (see http://spec.commonmark.org/0.28/#example-197) 2018-01-19 03:58:30 +01:00
Federico Soave
1a71ae06bf new blockquote rule: match any paragraph-like content up to next line (laziness rule), or anything on the current line. Change paragraph rule accordingly, and make it non-greedy 2018-01-19 03:58:30 +01:00
Federico Soave
9400980e16 paragraph rule: link defs cannot interrupt a paragraph 2018-01-19 03:25:33 +01:00
Federico Soave
a5c4889cf0 link def labels cannot contain balanced brackets 2018-01-19 03:25:33 +01:00
Federico Soave
f2ebbd1601 first link definition takes precedence 2018-01-19 03:25:33 +01:00
Federico Soave
d7597f1732 allow link definitions in blockquotes too 2018-01-19 03:25:33 +01:00
Federico Soave
c3e005908e new rule for link definitions: allow for special chars in label and title, multiline 2018-01-19 03:25:33 +01:00
Federico Soave
38f1b01036 allow escaped or balanced square brackets in shortcut reflinks 2018-01-19 03:25:33 +01:00
AndyTheGiant
958777e9fe remove unused flags 2018-01-15 18:16:54 +01:00
Federico Soave
60738f8343 export TextRenderer for convenience 2018-01-15 03:25:26 +01:00
Federico Soave
31dffdeb23 pass only the textual part as the 'raw' argument for heading renderer 2018-01-15 03:25:18 +01:00
Federico Soave
de73c39038 strip unused argument (introduced in 2636f85) 2018-01-15 02:34:41 +01:00
Federico Soave
b2a07608e1 fix backticks in inline code (fixes #312) 2018-01-14 23:19:51 +01:00
Federico Soave
2c11624736 preserve trailing newlines in code fences 2018-01-12 18:02:49 +01:00
Josh Bruce
3175599eae
Merge pull request #612 from guotie/patch-1
Update marked.js
2018-01-09 22:44:29 -05:00
Костя Третяк
bff566720d
Revert 98ac7a4395 and a477d1d0e2 2018-01-08 19:50:03 +02:00
Josh Bruce
4a5cf949ec
Merge pull request #852 from jeremyblalock/master
Make erroneous / dangerous links display as text only

Slated for 0.3.10
2018-01-05 18:27:22 -05:00
Josh Bruce
99eee90c91
Merge pull request #991 from learykara/patch-3
Declare undeclared variables
2018-01-05 17:55:15 -05:00
Kara Leary
14fca790fc
add 'use strict' to top of function 2018-01-05 06:19:25 -10:00
Josh Bruce
398bb715c7
Merge pull request #993 from smhg/fix-ie8-regex
Support older regex engines
2018-01-04 22:33:28 -05:00