-
Notifications
You must be signed in to change notification settings - Fork 82
fix: no-reversed-media-syntax add missing offset for code spans #460
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
fix: no-reversed-media-syntax add missing offset for code spans #460
Conversation
… checking the bounds of code spans
| dedent` | ||
| # Heading, | ||
| \`myobj.getFiles(test)[0]\`, | ||
| `, | ||
| dedent` | ||
| foo | ||
| # Heading, | ||
| \`myobj.getFiles(test)[0]\`, | ||
| `, |
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.
Good catch, thanks 👍
Interestingly, the current test cases don’t detect the changed logic properly, since the matchIndex is ignored by the range of the InlineCode node by chance!
So even if we revert this change, the test cases still pass 😄
| dedent` | |
| # Heading, | |
| \`myobj.getFiles(test)[0]\`, | |
| `, | |
| dedent` | |
| foo | |
| # Heading, | |
| \`myobj.getFiles(test)[0]\`, | |
| `, | |
| dedent` | |
| # Heading | |
| \`(test)[0]\` | |
| `, | |
| dedent` | |
| foo | |
| # Heading | |
| \`(test)[0]\` | |
| `, |
Would it be possible to use the above test cases instead? If we modify them, the tests wouldn’t pass if we reverted this change.
Also, it’s not a technical issue, but I think the comma (,) was added by mistake. If it wasn’t intentional, it would be great if you could remove it.
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.
You are right that it did not actuall test the change 😅 .
I removed the unnecessary first test case and added more text in the next.
lumirlumir
left a comment
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, thanks!
Would like another review before merging.
nzakas
left a comment
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. It's okay to not create an issue, but in the future, please use the same format for the PR description as the bug template (What did you do, what happened, what did you expect to happen, etc.). It makes it a lot easier to understand what you're trying to fix.
Prerequisites checklist
What is the purpose of this pull request?
Fix a bug in
no-reversed-media-syntax-inlinefor ignoring text inside code blocks.What changes did you make? (Give an overview)
Add the offset of the paragraph when comparing whether the matched text is inside code spans.
This is required as the regular expression match index is relative to the paragraph and the offsets of the code span is absolute.
They only match up if the paragraph containing the code span is the first node.
Related Issues
I hope it is okay not create an issue for such a small change/fix.
Is there anything you'd like reviewers to focus on?