Skip to content

Consecutive emphasis miss #27

Description

@flintforge

The \space in the post-emphasis regex is consumed by the regex.
*bold* *bold* *bold*
renders
bold *bold* bold

The stub/editor isn't up to date so I gave up on the pull request or exhaustive testing but a partial fix looks like this :

# parser.js +566
while ((match = emphasisPattern.exec(text))) {
      var whole  = match[0];
      var pre    = match[1];
      var marker = match[2];
      var body   = match[3];
      let post = []
      if (match.index === emphasisPattern.lastIndex) {
	 emphasisPattern.lastIndex++;
	 post = match[4];
      }

[...]

# parser.js +659
buildEmphasisPattern() {
	return new RegExp(
		"([" + this.preEmphasis + "]|^|\r?\n)" +     // \1 => pre
		"([" + this.markers + "])" +                 // \2 => marker
		"([^" + this.borderForbidden + "]|" +        // \3 => body
		"[^" + this.borderForbidden + "]" + this.bodyRegexp +
		"[^" + this.borderForbidden + "])" +
		"\\2" +
		"(?=[" + this.postEmphasis + "]|$|\r?)",     // \4 => post
		// flags
		"g"
	);

Incomplete however as this does eat up a space in consecutive emphasis separated by a newline

/ita/ 
/ita/

->
itaita

consecutive emphasis with two separators renders fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions