commonmark / cmark

CommonMark parsing and rendering library and program in C
Other
1.64k stars 546 forks source link

[Bugfix] Fix the backticks bug #427

Closed Kyle-Ye closed 2 years ago

Kyle-Ye commented 2 years ago

See more info and context here https://github.com/apple/swift-cmark/pull/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 commented 2 years ago

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 commented 2 years ago

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.

https://github.com/commonmark/cmark/blob/a8da5a2f252b96eca60ae8bada1a9ba059a38401/src/inlines.c#L394-L397

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

init_pos or initpos which do you prefer @jgm

jgm commented 2 years ago

Yes, initpos would be better.

Kyle-Ye commented 2 years ago

Yes, initpos would be better.

Done.

Kyle-Ye commented 2 years ago

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

jgm commented 2 years ago

Thanks for this!