-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
More flexible citation key syntax #6026 #6373
Conversation
I'm not sure about the idea of allowing escapes in regular citations (without the |
d39951e
to
3b8d38b
Compare
Changed. |
<|> char '{' *> | ||
many `id` choice | ||
[ noneOf "}\n\\" | ||
, ' ' <$ newline <* skipSpaces <* notFollowedBy newline | ||
, char '\\' *> anyChar | ||
] | ||
<* char '}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for newlines, I think it would make sense to allow newlines only if not followed by a blankline (there's a parser for this
I think you mean spnl
? That one is in Readers/Markdown.hs
, so not available here unless we move it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wondered if it would be more consistent to parse any occurrence of multiple spaces as a single space. The way it is now I would think it may be especially confusing with trailing spaces? If one wants multiple spaces they can still escape them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we could collapse consecutive spaces, that might make sense.
I suggest an alternative approach for handling squiggly braces within a key, which is to parse nested brace or parenthesis pairs. Thus If a later need arises to support the remaining cases, then I would suggest doing so through a slightly more explicit form, such as |
@brainchild0 I see the point for matching braces. It is probably more common for braces to appear paired than on their own. For other parenthesis I don't see the benefit. |
Yes, you may be right that in this case matching other braces is unnecessary, as long as they are protected from the processing that would occur in a regular context. Thus the first |
An additional benefit of this pull request might be that it allows a way to terminate a citekey without space or punctuation. Specifically, Where this would come in handy is for filter like |
Looks like 3f09f53 added this feature. |
Oh, I'm sorry -- I'd completely forgotten about this PR! |
This implements the
{citekey}
syntax and also allows escaping using\
both}
and\
inside{}
and any illegal character in the existing syntax.This does not address all of #6026. I still want to implement the
[@citekey]: citekey'
syntax.TODO: