summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-09-10 09:30:23 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-09-11 11:17:41 -0700
commit5f56a1988ff8edfc020c97e37dbf834b499157d6 (patch)
treeefd0ae5b0f8222699ad6d9fe2e831016ce60039d /js
parent5cd513026fe49e83cfd544a7b375bf4fa1466b21 (diff)
Fixed bug.
Diffstat (limited to 'js')
-rwxr-xr-xjs/stmd.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/js/stmd.js b/js/stmd.js
index 7c7362e..0cfb6b3 100755
--- a/js/stmd.js
+++ b/js/stmd.js
@@ -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;