Skip to content

Conversation

@movitto
Copy link

@movitto movitto commented Aug 9, 2018

Greetings! This patch facilitates the inclusion of DOM elements in the JSON data rendered with renderjson. With this one could modify the json ( for example with the 'apply' method in a library such as jsonpath) so as to contain custom DOM elements & formatting for specific items before passing the entire document to renderjson as outlined in the docs. Before this patch, the createTextNode method would result in raw html being rendered on the output DOM structure whereas now DOM elements will simply be added to it.

I've tested and verified this locally, though if this patch is unagreeable or won't work for any particular use case, let me know and we can try to devise and acceptable solution.

Thank you for your time.

This allows JSON to be manipulated so as to contain DOM elements before
being passed to renderjson. Nested DOM elements will be processed as is,
being added to the output DOM structure without modifications (previously
the call to createTextNode was resulting in raw HTML being output.
@Almenon
Copy link
Contributor

Almenon commented Nov 3, 2018

I could use this for Almenon/AREPL-vscode#73, nice PR :)

I'm suprised that just took a two line code change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants