Created
August 28, 2020 16:23
-
-
Save karlhorky/71dda7dfb9327e98fdb7a01574626b48 to your computer and use it in GitHub Desktop.
Prettify Runkit HTML Output with Prettier
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
// Prettify Runkit HTML | |
// (Not relevant for demo) | |
const html = '<div id="a">asdf</div>'; | |
const prettier = require("prettier"); | |
'<pre>' + | |
prettier | |
.format(html, {parser: 'html', htmlWhitespaceSensitivity: 'ignore'}) | |
.replace(/</g, '<') + | |
'</pre>'; | |
// See demo here: https://runkit.com/embed/mfigg7b3rcb5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment