Skip to content

[Bugfix] Fix the backticks bug#427

Merged
jgm merged 2 commits intocommonmark:masterfrom
Kyle-Ye:master
Nov 10, 2021
Merged

[Bugfix] Fix the backticks bug#427
jgm merged 2 commits intocommonmark:masterfrom
Kyle-Ye:master

Conversation

@Kyle-Ye
Copy link
Copy Markdown
Contributor

@Kyle-Ye Kyle-Ye commented Nov 10, 2021

See more info and context here swiftlang#26

In brief:
When parse "`A" and "``A"
Before the PR: We'll get text sourcepos 1:2-1:2 and 1:3-1:3
After the PR: We'll get text sourcepos 1:1-1:2 and 1:1-1:3

@jgm
Copy link
Copy Markdown
Member

jgm commented Nov 10, 2021

Looks good -- I'd only ask that we have init_pos instead of initPos for consistency with the style of the rest of the code.

@Kyle-Ye
Copy link
Copy Markdown
Contributor Author

Kyle-Ye commented Nov 10, 2021

Looks good -- I'd only ask that we have init_pos instead of initPos for consistency with the style of the rest of the code.

cmark/src/inlines.c

Lines 394 to 397 in a8da5a2

static cmark_node *handle_backticks(subject *subj, int options) {
cmark_chunk openticks = take_while(subj, isbacktick);
bufsize_t startpos = subj->pos;
bufsize_t endpos = scan_to_closing_backticks(subj, openticks.len);

Seems like initpos would better fit the position here.(startpos and endpos)

init_pos or initpos which do you prefer @jgm

@jgm
Copy link
Copy Markdown
Member

jgm commented Nov 10, 2021

Yes, initpos would be better.

@Kyle-Ye
Copy link
Copy Markdown
Contributor Author

Kyle-Ye commented Nov 10, 2021

Yes, initpos would be better.

Done.

@Kyle-Ye
Copy link
Copy Markdown
Contributor Author

Kyle-Ye commented Nov 10, 2021

Could we run test on it again and merge it. cc @jgm

@jgm jgm merged commit affa616 into commonmark:master Nov 10, 2021
@jgm
Copy link
Copy Markdown
Member

jgm commented Nov 10, 2021

Thanks for this!

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