Skip to content

Commit

Permalink
Fix backslash in [^ block
Browse files Browse the repository at this point in the history
This backslash was being ignored because `\_` is the same as `_`.
It should have been `\\_` in the regex and `"\\\\_"` in the string,
so that it only accepts backslashes followed by characters, and the
`[^` block never tries to take a backslash and then has to backtrack
for the `\\\\[\\s\\S]` block :).

Also bumped the version for this bugfix
  • Loading branch information
ariabuckles committed Jun 10, 2016
1 parent c9c0352 commit 50b12c8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-markdown",
"version": "0.1.0",
"version": "0.1.1",
"description": "Javascript markdown parsing, made simple",
"main": "simple-markdown.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion simple-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ var defaultRules = {
new RegExp(
// only match _s surrounding words.
"^\\b_" +
"((?:__|\\\\[\\s\\S]|[^\\_])+?)_" +
"((?:__|\\\\[\\s\\S]|[^\\\\_])+?)_" +
"\\b" +
// Or match *s:
"|" +
Expand Down
Loading

0 comments on commit 50b12c8

Please sign in to comment.