Skip to content

Commit

Permalink
allow brackets in link text if they are inside a code span. Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Feder1co5oave committed Mar 5, 2018
1 parent 271d357 commit 47365c1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ inline.tag = edit(inline.tag)
.replace('attribute', inline._attribute)
.getRegex();

inline._inside = /(?:\[[^\]]*\]|\\[\[\]]|[^\[\]]|\](?=[^\[]*\]))*/;
inline._inside = /(?:\[[^\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/;
inline._href = /\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s()\\]*\)|[^\s()\\])*?)/;
inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;

Expand Down
2 changes: 2 additions & 0 deletions test/new/nested_square_link.html
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<p><a href="/url">the <code>]</code> character</a></p>

<p><a href="/url">the ` character</a></p>
2 changes: 2 additions & 0 deletions test/new/nested_square_link.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
[the `]` character](/url)

[the ` character](/url)

0 comments on commit 47365c1

Please sign in to comment.