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

Clarify escapes in link reference definitions #600

Closed
wooorm opened this issue Sep 7, 2019 · 4 comments
Closed

Clarify escapes in link reference definitions #600

wooorm opened this issue Sep 7, 2019 · 4 comments

Comments

@wooorm
Copy link
Contributor

wooorm commented Sep 7, 2019

Link reference definitions consist (sometimes optionally) of link labels, unbracketed link destinations, and single, double, or bracketed (parens) link titles.

These segments can include escaped characters (specifically ], (, ), ', and ").
However, for the definition of these segments, link reference definitions reference links, which are inline.
The problem here is that inline constructs have a concept of escapes, whereas block constructs don’t.
Link reference definitions are the only block construct that mention escapes.

The problem here is that it’s a bit ambiguous what “escape” is in block constructs? As there are apparently escapes in blocks, are they backslash escapes? Are “hard line breaks” includes in definitions? Is x\\] fine, because it is a backslash and a right square bracket? 🤷‍♂️

N.B. I think I get what the spec is going for, to parse backslash escapes (as in, ascii punctuation) but not hard line breaks, however, I think it may be good to clarify the spec text.

@Crissov
Copy link
Contributor

Crissov commented Sep 8, 2019

Just an aside: the link destination may be “bracketed”, of course, i. e. include a < prefix and a > suffix.

@wooorm
Copy link
Contributor Author

wooorm commented Sep 8, 2019

@Crissov Definitely, but I didn’t mention it because parsing of bracketed (as in, angle brackets) around a link destination doesn‘t include escapes, according to the spec as it currently is.

@jgm
Copy link
Member

jgm commented Sep 9, 2019

Maybe the subsection on "backslash escapes" should simply be moved out of the Inlines section, and into Preliminaries. It makes many references to both block and inline contexts, so it's not meant to apply only to inlines. (I can see how you'd be led to think that, though.) The section on backslash escapes tries to list all of the contexts where backslash escapes don't work. If there are omissions, please let us know.

@wooorm
Copy link
Contributor Author

wooorm commented Sep 9, 2019

It makes many references to both block and inline contexts

Yeah that can work! I think the contextual problem arises from the block syntax linking to the inline syntax for its definitions, which includes backslash escapes. This would solve that.

Come to think of it, a related issue may be that character references can also be used to “escape” syntax, in this particular case &#93;, or its hexadecimal version, for ]. Can they be used in the link reference definition label, destination, title? Would they need to be moved up as well?
It may also be good to group them both “escapes”, and in the rest of the document use the term “escape” instead of specifically “backslash-escaped” (such as here)

@jgm jgm closed this as completed in 0c8cd35 Sep 9, 2019
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

3 participants