Open KiranWells opened 3 years ago
After there was no response for a while, I'm not so sure if this module will be maintained or if it's just here for reference.
First requirement will be to export the insertFolds
function. I will send a pull request for this.
Then I made it working by using the insertFolds
function like this:
import {insertFolds} from "prism-js-fold";
Prism.highlightElement(codeElement);
insertFolds(codeElement);
… respectively …
import {insertFolds} from "prism-js-fold";
codeElement.innerHTML = Prism.highlight(myJsonContent, Prism.languages.json, 'json');
insertFolds(codeElement);
Is this also working for you, @KiranWells?
When I used this with manual highlighting and
Prism.highlight
, it simply did nothing. After digging around in the code for a bit, I noticed that:'before-all-elements-highlight'
hook).Here is what finally got it working for me (using the js and css files directly from GitHub):
This could possibly be fixed with an
"after-highlight"
hook, although I am not sure if it works the same asPrism.highlight
. My results with a hook always seemed to have thedetails
andsummary
elements stripped out.