Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Left-flanking / right-flanking (again?) #310

Closed
mildsunrise opened this issue Mar 10, 2015 · 3 comments
Closed

Left-flanking / right-flanking (again?) #310

mildsunrise opened this issue Mar 10, 2015 · 3 comments

Comments

@mildsunrise
Copy link
Contributor

I'm kinda pissed off. I implemented emphasis according to the spec, and now my parser is rendering _foo_ as <p>_foo_</p>. I verified that, according to the rules in 0.17, the two delimiter runs are both right- and left- flanking. So my parser is actually right!

So I go checkout 0.18 and I find the definition has changed a bit, it's now even more permissive. So _foo_ is still <p>_foo_</p>. I also checked master before submitting this.

Then I find in #302 (and in CMark code) that the code treats start of line and end of line as whitespace, and @jgm attempted to correct the spec. However _foo_ is still having both left- and right- flanking delimiter runs.

I suppose this would be fixed by changing:

 A [left-flanking delimiter run](@left-flanking-delimiter-run) is
-a [delimiter run] that is (a) not followed by [unicode whitespace],
+a [delimiter run] that is (a) not followed by [unicode whitespace] or end of line,
 and (b) either not followed by a [punctuation character], or
 preceded by [unicode whitespace] or a [punctuation character] or
 the beginning of a line.

 A [right-flanking delimiter run](@right-flanking-delimiter-run) is
-a [delimiter run] that is (a) not preceded by [unicode whitespace],
+a [delimiter run] that is (a) not preceded by [unicode whitespace] or end of line,
 and (b) either not preceded by a [punctuation character], or
 followed by [unicode whitespace] or a [punctuation character] or
 the end of a line.

But those two definitions are getting very messy IMO...

@jgm
Copy link
Member

jgm commented Mar 11, 2015

+++ Xavier Mendez [Mar 10 15 13:59 ]:

I'm kinda pissed off. I implemented emphasis according to the spec, and
now my parser is rendering foo as

foo

. I verified that,
according to the rules in 0.17, the two delimiter runs are both right-
and left- flanking. So my parser is actually right!

So I go checkout 0.18 and I find the definition has changed a bit, it's
now even more permissive. So foo is still

foo

. I also
checked master before submitting this.

Then I find in [1]#302 (and in CMark code) that the code treats start
of line and end of line as whitespace, and [2]@jgm attempted to correct
the spec. However foo is still having both left- and right- flanking
delimiter runs.

My original instinct in adjusting the spec was just to add:
"for these purposes the beginning and end of the line count
as whitespace." I then decided to make it more explicit, but
as you've pointed out, I didn't get it quite right.

For the sake of simplicity, would it be better to say the
following?

A left-flanking delimiter run is
-a [delimiter run] that is (a) not followed by [unicode whitespace],
and (b) either not followed by a [punctuation character], or
preceded by [unicode whitespace] or a [punctuation character].
For these purposes the beginning and end of line count as
[unicode whitespace].

@mildsunrise
Copy link
Contributor Author

Yeah.

@jgm
Copy link
Member

jgm commented Mar 11, 2015

See commonmark/commonmark.js#12 for a related issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants