Skip to content

allow extensions to use ! and ^ as special characters#30

Merged
QuietMisdreavus merged 3 commits into
gfmfrom
QuietMisdreavus/extended-ext
Mar 16, 2022
Merged

allow extensions to use ! and ^ as special characters#30
QuietMisdreavus merged 3 commits into
gfmfrom
QuietMisdreavus/extended-ext

Conversation

@QuietMisdreavus
Copy link
Copy Markdown

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.

@QuietMisdreavus
Copy link
Copy Markdown
Author

I split off a change from #28 into this branch so that make test could pass with the swift-cmark-gfm changes.

@QuietMisdreavus
Copy link
Copy Markdown
Author

I've rebased this PR atop the new updates in #29.

Comment thread src/inlines.c
push_bracket(subj, IMAGE, new_inl);
}
break;
default:
Copy link
Copy Markdown

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?

Copy link
Copy Markdown
Author

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.

@QuietMisdreavus QuietMisdreavus force-pushed the QuietMisdreavus/extended-ext branch from 46bda92 to 05a5f22 Compare March 11, 2022 16:47
Comment thread src/inlines.c
case '!':
advance(subj);
if (peek_char(subj) == '[' && peek_char_n(subj, 1) != '^') {
if (peek_char_n(subj, 1) == '[' && peek_char_n(subj, 2) != '^') {
Copy link
Copy Markdown

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 "![(!^)"

Copy link
Copy Markdown

@daniel-grumberg daniel-grumberg left a 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

Base automatically changed from QuietMisdreavus/sync-upstream to gfm March 16, 2022 18:50
QuietMisdreavus and others added 3 commits March 16, 2022 12:57
- generalize the special-character-inline-creating section
- add comments about looking for images and attributes specificall
@QuietMisdreavus QuietMisdreavus force-pushed the QuietMisdreavus/extended-ext branch from d9b0520 to 76ae837 Compare March 16, 2022 18:58
@QuietMisdreavus QuietMisdreavus merged commit c816eae into gfm Mar 16, 2022
@QuietMisdreavus QuietMisdreavus deleted the QuietMisdreavus/extended-ext branch March 16, 2022 18:59
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

Successfully merging this pull request may close these issues.

2 participants