-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(enh) prevent rehighlighting of an element
- Loading branch information
1 parent
f4bf02a
commit 3987abe
Showing
2 changed files
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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
3987abe
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.
@joshgoebel
dataset.highlighted
should be mentioned in the README.This is a pretty big change for anyone that ever replaces the contents or the language of an element with highlighted code. It means that you now have a mandatory step of clearing the property before you call
hljs.highlightElement
:This broke how I was using highlight.js, which was letting users type code and re-highlighting it on every keystroke.
3987abe
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'm unsure about the README, but definitely worth a mention in the docs I'd say.
But this is absolutely a breaking change and should not have made it into a minor release. You have my apology there. At this point (2 weeks after release) with no other reports though, I think it may be best to leave it in and just document it vs issuing a patch release to rip it out.
@allejo Any opinion here on document vs revert?
3987abe
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.
Unfortunately, it's already made it into a release and has been out for a bit already. Since this is the first complaint, I vote to document it and append the release notes/changelog describing this accidental breaking change.
If we receive more complaints about this breaking people's workflows, I'd say we can have a patch release with this reverted (or being opt-in behavior, which ever makes the most sense).
3987abe
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 have the same problem. When I remove the attribute, I get the following message
When I reload the page, the code is formatted normally and the message does not appear.
I am definitely in favour of an opt-in.
3987abe
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.
Because it includes HTML. If you wanted to re-highlight it (without a warning) you need to replace it with just raw text first - no HTML.
3987abe
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.
@verhovsky @ITrunsDE
Dynamic behavior can be faked with an editor mask. The mask will be transparent showing invisible text, but will show the caret and highlighting. As the user edits the invisible text the highlightjs will display behind the mask correctly. For all intensive purposes the user should be unaware of this.
Example: