-
Notifications
You must be signed in to change notification settings - Fork 132
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
Add Support for Highlighting Multiple Words in the Same Line #2059
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
packages/cli/test/functional/test_site/expected/testCodeBlocks.html
Outdated
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Yap, I am still interested but been really busy please give me a week or so, thx!! |
Hi @zlimez, are you still keen to work on this PR? No pressure if you arent |
Sorry I completely forgot about the existence of this PR, can I have till end of this week to fast forward and update the documentations? |
Yup sure! Feel free to reach out if there is any issues with merge conflicts as these files have been since converted to typescript |
I have added documentations and migrated to TS. Please help me review and soz for taking so long. |
Hi hi, as per my latest comment I am done with the migration and docs when you are free please kindly help me review 🙂 |
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.
Thanks for working on this @zlimez!
Haven't tested the functionality as I'm lacking context on this issue but added some comments on the code :)
This comment was marked as resolved.
This comment was marked as resolved.
packages/core/src/lib/markdown-it/highlight/HighlightRuleComponent.ts
Outdated
Show resolved
Hide resolved
packages/core/test/unit/lib/markdown-it/highlight/helper.test.ts
Outdated
Show resolved
Hide resolved
packages/core/test/unit/lib/markdown-it/highlight/HighlightRuleComponent.test.ts
Outdated
Show resolved
Hide resolved
@zlimez sorry for the delay, review is underway. If you could spare some time to revisit this PR, please see if there are readability fixes that you can apply. Thanks. |
Ok I will take a look. Thanks. |
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.
Hi @zlimez, just a few more comments to address and I think it should be good to merge soon.
packages/core/test/unit/lib/markdown-it/highlight/HightlightRule.test.ts
Show resolved
Hide resolved
packages/core/test/unit/lib/markdown-it/highlight/HightlightRule.test.ts
Show resolved
Hide resolved
I have extracted the line number check as per requested hope it is alright |
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
@all-contributors please add @zlimez for code |
I've put up a pull request to add @zlimez! 🎉 |
Yeah thx for helping me review for so long >< |
What is the purpose of this pull request?
Overview of changes:
Fixes #2050
Suspect this is the block of code preventing multiple words to be highlighted separately on the same line, as only the first highlight rule is applied.
Modified to collate all rules that is applied to the current line, then apply them as a batch.
Anything you'd like to highlight/discuss:
Overlapping highlight intervals are combined and processed in
helper.js
collateAllIntervals(boundaries)
function. ExtractapplyHighlight
method from 'HighlightRule' toHighlighter
. Not certain if that is the best approach.Highlight line takes precedence over highlight whole text over highlight partial text when applied on the same line. Again, not sure if this is the desirable behaviour.
Testing instructions:
Edits made to
testCodeBlocks.md
:partial word variant
,full word variant
,partial character variant
andfull word variant
to include situations where more than one highlight rules is applied on one line.all attr should behave as expected
, that does a combined testing of all highlight rules, with some overlapping bounds.Sample output
Checklist: ☑️