Skip to content
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

Deprecate fixMarkup public API #2534

Closed
joshgoebel opened this issue May 5, 2020 · 2 comments
Closed

Deprecate fixMarkup public API #2534

joshgoebel opened this issue May 5, 2020 · 2 comments
Labels
discuss/propose Proposal for a new feature/direction parser
Milestone

Comments

@joshgoebel
Copy link
Member

joshgoebel commented May 5, 2020

fixMarkup is the second half of the transformation process that happens when someone uses useBR. The first half of the process is private code.

  • This function is really only useful when paired with the first half, which is private code.
  • The library does this automatically when you use highlightBlock.
  • It's the only random utility function we currently expose other than inherit.

We should focus on highlighting, not providing random string utility functions. So far the only need for this to be public I've heard is #2529. That was actually a misunderstanding and the function wasn't required at all.

The use case though was:

I'm using React (or something) and I need to highlightBlock but without calling highlightBlock (since I can't modify the DOM). So I'm essentially building my own highlightBlock and I want to use this method like the internal code does.

I'm pretty sure the simple answer here is the block in question doesn't need to be part of the DOM... so you could make a new block, highlight, and then fetch the code...

let div = document.createElement('div');
div.innerHTML = actualElement.innerHTML;
hljs.highlightBlock(div);
// do with div.result it as you please

But really I'd like to learn more about the popular/common usage patterns with React/Vue/other frameworks and see if we could better support them in general - or make them easy to support with an official plugin. IE, if there is some weird need for fixMarkup now, remove that need.

@joshgoebel joshgoebel added parser discuss/propose Proposal for a new feature/direction labels May 5, 2020
@joshgoebel joshgoebel added this to the 11.0 milestone May 5, 2020
@joshgoebel joshgoebel changed the title Propose: Remove fixMarkup API Propose: Remove/deprecate fixMarkup API May 5, 2020
@joshgoebel joshgoebel changed the title Propose: Remove/deprecate fixMarkup API Propose: Deprecate fixMarkup API May 5, 2020
@joshgoebel joshgoebel changed the title Propose: Deprecate fixMarkup API Propose: Remove fixMarkup API May 5, 2020
@joshgoebel joshgoebel changed the title Propose: Remove fixMarkup API Propose: Remove fixMarkup public API May 5, 2020
@joshgoebel joshgoebel changed the title Propose: Remove fixMarkup public API Remove fixMarkup public API Sep 5, 2020
@joshgoebel
Copy link
Member Author

621ba9d

@joshgoebel joshgoebel changed the title Remove fixMarkup public API Deprecate fixMarkup public API Sep 5, 2020
@joshgoebel
Copy link
Member Author

Renaming this to deprecate and making complete. The "remove" portion can be tracked by the v11 todo list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss/propose Proposal for a new feature/direction parser
Projects
None yet
Development

No branches or pull requests

1 participant