diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-09-10 09:30:23 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-09-11 11:17:41 -0700 |
commit | 5f56a1988ff8edfc020c97e37dbf834b499157d6 (patch) | |
tree | efd0ae5b0f8222699ad6d9fe2e831016ce60039d /js/stmd.js | |
parent | 5cd513026fe49e83cfd544a7b375bf4fa1466b21 (diff) |
Fixed bug.
Diffstat (limited to 'js/stmd.js')
-rwxr-xr-x | js/stmd.js | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -70,8 +70,9 @@ var reAllTab = /\t/g; var reHrule = /^(?:(?:\* *){3,}|(?:_ *){3,}|(?:- *){3,}) *$/; // Matches a character with a special meaning in markdown, -// or a string of non-special characters. -var reMain = /^(?:[\n`\[\]\\!<&*_]|(?: *[^\n `\[\]\\!<&*_]+)+|[ \n]+)/m; +// or a string of non-special characters. Note: we match +// clumps of _ or * or `, because they need to be handled in groups. +var reMain = /^(?:[_*`\n]+|[\[\]\\!<&*_]|(?: *[^\n `\[\]\\!<&*_]+)+|[ \n]+)/m; // UTILITY FUNCTIONS @@ -277,16 +278,16 @@ var parseEmphasis = function() { res = this.scanDelims(c); numdelims = res.numdelims; - if (numdelims >= 4) { - this.pos += numdelims; - return {t: 'Str', c: this.subject.slice(startpos, startpos + numdelims)}; - } - - if (!res.can_open || numdelims === 0) { + if (numdelims === 0) { this.pos = startpos; return null; } + if (numdelims >= 4 || !res.can_open) { + this.pos += numdelims; + return {t: 'Str', c: this.subject.slice(startpos, startpos + numdelims)}; + } + this.pos += numdelims; var next_inline; |