-
Notifications
You must be signed in to change notification settings - Fork 96
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
allow extensions to use !
and ^
as special characters
#30
Conversation
I split off a change from #28 into this branch so that |
4c40013
to
2cd664e
Compare
1e705e9
to
46bda92
Compare
I've rebased this PR atop the new updates in #29. |
2cd664e
to
131078b
Compare
} | ||
break; | ||
default: |
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.
What happenned to the default case? Did you just push it outside the switch?
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. I had to move the try_extensions
call outside of this switch, so that it could be tried with characters that are part of the built-in grammar (specifically ^
and [
). That's also why i modified the !
and ^
branches to peek for their syntax instead of eagerly advancing the pointer.
46bda92
to
05a5f22
Compare
@@ -1563,43 +1564,49 @@ static int parse_inline(cmark_parser *parser, subject *subj, cmark_node *parent, | |||
new_inl = handle_close_bracket(parser, subj); | |||
break; | |||
case '!': | |||
advance(subj); | |||
if (peek_char(subj) == '[' && peek_char_n(subj, 1) != '^') { | |||
if (peek_char_n(subj, 1) == '[' && peek_char_n(subj, 2) != '^') { |
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.
Maybe add a comment saying that this case is not effectively "![(!^)"
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.
LGTM after offline discussion
- generalize the special-character-inline-creating section - add comments about looking for images and attributes specificall
d9b0520
to
76ae837
Compare
While implementing updates for #28, and while verifying changes for #29, i noticed that some special characters weren't being handled properly, and couldn't be used by extensions. This updates the
parse_inline
function to allow^
and!
to be used as special characters by extensions. This also allows footnotes to work with our implementation of inline attributes, allowing the full test suite to pass.