-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Hey there! π
I needed to add some functionality today that replaces random attributes with deterministic ones. Specifically, I am working with v-tooltip, which generates random ids that end up in the component's HTML.
I essentially needed to add a line after this one that was something to the effect of html = standardizeRandomIDs(html), but your library currently doesn't expose a way to add that functionality.
I had to copy your library to a local file and add the custom replace myself. π’
Would you consider opening up your print method to optionally take a callback that defines custom replace logic? Something like:
module.exports = {
// test (received) { ... },
print (received, cb) {
let html = (isVueWrapper(received) ? received.html() : received) || ''
html = removeServerRenderedText(html)
html = removeDataTestAttributes(html)
if(cb) html = cb(html)
return beautify(html, { indent_size: 2 })
}
}That way, I could have a least imported it and created a wrapper around it instead of copying and pasting all the code over to make the edits.
What do you think?