Skip to content
This repository has been archived by the owner on Feb 24, 2025. It is now read-only.

Fix parsing of inline code blocks with multiple backticks #260

Merged
merged 2 commits into from
Sep 13, 2019

Conversation

srawlins
Copy link
Collaborator

@srawlins
Copy link
Collaborator Author

The failed internal check is fine; we have a broken patch file.

bool canParse(BlockParser parser) {
var match = pattern.firstMatch(parser.current);
if (match == null) return false;
final codeFence = match.group(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use var here and below or final above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

//
// > If the info string comes after a backtick fence, it may not contain
// > any backtick characters.
if (codeFence.codeUnitAt(0) == $backquote &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

return codeFence.codeUnitAt(0) != $backquote ||
    !infoString.codeUnits.contains($backquote));

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Collaborator Author

@srawlins srawlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

bool canParse(BlockParser parser) {
var match = pattern.firstMatch(parser.current);
if (match == null) return false;
final codeFence = match.group(1);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

//
// > If the info string comes after a backtick fence, it may not contain
// > any backtick characters.
if (codeFence.codeUnitAt(0) == $backquote &&
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@kevmoo
Copy link
Contributor

kevmoo commented Sep 13, 2019

Land it!

@srawlins srawlins merged commit b677ece into dart-archive:master Sep 13, 2019
@srawlins srawlins deleted the fix-multiple-backtick-code branch September 13, 2019 19:15
mosuem pushed a commit to dart-lang/tools that referenced this pull request Dec 9, 2024
…ve/markdown#260)

Fix parsing of inline code blocks with multiple backticks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

Render inconsistencies with three backticks (code block) (compared to GitHub)
4 participants