-
Notifications
You must be signed in to change notification settings - Fork 141
Code blocks: Support partial text highlighting #1478
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
Merged
ang-zeyu
merged 21 commits into
MarkBind:master
from
ryoarmanda:part-of-text-highlighting
Feb 27, 2021
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
a8e297c
Develop partial text highlighting
ryoarmanda 913f05e
Incorporate line slice syntax on line range processing
ryoarmanda 70ff67d
Update codeblock documentations
ryoarmanda 52c6513
Update codeblock docs example
ryoarmanda f08167d
Update tests
ryoarmanda f7f9b55
Merge branch 'master' into part-of-text-highlighting
ryoarmanda cd7c0ea
Address reviews
ryoarmanda 761066c
Add more convenience syntax for partial text highlight
ryoarmanda e0ad241
Generalize parts to slices conversion to multiple components
ryoarmanda 61bd569
Tidy up and fix mistakes
ryoarmanda ef72888
Update tests
ryoarmanda 2499138
Update docs
ryoarmanda 26e9d25
Update docs again
ryoarmanda 94f8b9a
Merge branch 'master' into part-of-text-highlighting
ryoarmanda ce67bf9
Improve line part syntax to highlight multiple occurrences
ryoarmanda 363fd1f
Implement word-variant line-slice syntax
ryoarmanda 9e1d927
Move code block processing to new file
ryoarmanda 2f13afa
Move unescape helper to markdown-it
ryoarmanda 71fb389
Rework highlight rule processing flow
ryoarmanda 7e19b93
Summarize highlight rule formats documentation in a table
ryoarmanda cd40d8d
Address docs and minor code reviews
ryoarmanda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,8 +56,8 @@ Content in a fenced code block | |
| 20 | ||
| ``` | ||
|
|
||
| **`highlight-lines` attr with line-slice syntax of empty indices should highlight leading/trailing spaces | ||
| ```xml {highlight-lines="2[:],4[:]-5[:]"} | ||
| **`highlight-lines` attr with empty (any variant) line-slice syntax should highlight leading/trailing spaces** | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's add in the edge cases (if they are) earlier once fixed as well |
||
| ```xml {highlight-lines="2[:],3[::],4[:]-5[:]"} | ||
| <foo> | ||
| <bar type="name">goo</bar> | ||
| <baz type="name">goo</baz> | ||
|
|
@@ -66,6 +66,56 @@ Content in a fenced code block | |
| </foo> | ||
| ``` | ||
|
|
||
| **`highlight-lines` attr with full character-variant line-slice syntax should highlight only at specified range** | ||
| ```xml {highlight-lines="1[1:4],2[5:13],3[2:10]-4,5-6[1:4]"} | ||
| <foo> | ||
| <bar type="name">goo</bar> | ||
| <baz type="name">goo</baz> | ||
| <qux type="name">goo</qux> | ||
| <quux type="name">goo</quux> | ||
| </foo> | ||
| ``` | ||
|
|
||
| **`highlight-lines` attr with partial character-variant line-slice syntax should default highlight to start/end of line** | ||
| ```xml {highlight-lines="1[1:],2[:13],3[2:]-4,5-6[:2]"} | ||
| <foo> | ||
| <bar type="name">goo</bar> | ||
| <baz type="name">goo</baz> | ||
| <qux type="name">goo</qux> | ||
| <quux type="name">goo</quux> | ||
| </foo> | ||
| ``` | ||
|
|
||
| **`highlight-lines` attr with line-part syntax should highlight only at specified substring** | ||
| ```xml {highlight-lines="1[''],2['type'],3['baz'],4['go,o</qux>'],5['go\'o']"} | ||
| <foo> | ||
| <bar type="name">goo</bar> | ||
| <baz type="name">goo</baz> | ||
| <qux type="name">go,o</qux> | ||
| <quux type="name">go'o</quux> | ||
| </foo> | ||
| ``` | ||
|
|
||
| **`highlight-lines` attr with full word-variant line-slice syntax should highlight only at specified word ranges** | ||
| ```xml {highlight-lines="1[0::1],2[3::4],3[0::2],4[2::4],5[1::3]"} | ||
| <foo> | ||
| <bar type="name"> goo </bar> | ||
| <baz type="name"> goo </baz> | ||
| <qux type="name"> goo </qux> | ||
| <quux type="name"> goo </quux> | ||
| </foo> | ||
| ``` | ||
|
|
||
| **`highlight-lines` attr with partial word-variant line-slice syntax should default highlight to start/end of line** | ||
| ```xml {highlight-lines="1[0::],2[3::],3[::2],4[2::],5[::3]"} | ||
| <foo> | ||
| <bar type="name"> goo </bar> | ||
| <baz type="name"> goo </baz> | ||
| <qux type="name"> goo </qux> | ||
| <quux type="name"> goo </quux> | ||
| </foo> | ||
| ``` | ||
|
|
||
| **Should render correctly with heading** | ||
|
|
||
| ```{heading="A heading"} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
let's shift this up before
the value of highlight-lines...so the user has a brief idea what the usage is like first :-)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.
might have missed one ^ @ryoarmanda
disregard if it looks stranger
Uh oh!
There was an error while loading. Please reload this page.
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.
I did this already @ang-zeyu, I just reworded
the value of highlight-lines...to the ones in line85-86of the fileEdit: strange it doesn't show up in the diffs, you can look for it on the preview site, it's already changed there. Maybe because I force-pushed as I rebased a fixup?
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.
was suggesting the reverse - moving the example up (the
<include>tag), so the user gets a brief overview of the entire syntax usage first before the detailsThere 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.
Ahh okay, will rebase the fix shortly
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.
Done, the change is reverted in the force push :)