Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <html lang="en">
  <meta charset="UTF-8">
  <title>JSX Alternative to Render Virtual DOM</title>
  <h1>HTML to GlueDOM conversion</h1>
  <textarea id="html" class="editor"></textarea>
  <textarea id="glue-dom" class="editor"></textarea>
  <iframe id="parser" src="javascript:void(0)" style="display:none"></iframe>
  <p>Repo: <a href="" target="_blank"></a></p>
  <p>If you like it and want to get updated follow me on <a href="" target="_blank">twitter</a> or <a href="" target="_blank"></a></p>
  <p>Do you want to play with a tool which lets you code web apps with HTML and spits out the presented syntax? Visit <a href="" target="_blank"></a>.</p>
  <p>Visit <a href="" target="_blank"></a> for more.</p>


                .editor {
  min-width: 800px;
  min-height: 500px;



                const parserNode = document.querySelector('#parser')
const htmlNode = document.querySelector('#html')
const glueDomNode = document.querySelector('#glue-dom')

const parseHtml = nodeToParse => (
    domElements: [nodeToParse],
    settings: {
      transformVisualContent: false

const wrapHtmlInTestSlot = html => `
  <div gc-as="slot" gc-name="testSlot">${html}</div>

const transformGeneratedAst = (ast) => {
  const filteredAst = ast.body
    .find(node => node.type === 'ExportDefaultDeclaration')
  filteredAst.callee = {
    type: 'Identifier',
    name: 'tag'
  return filteredAst

const testHtml = `
<div class="card" style="width: 18rem;">
  <div class="card-body">
    <h5 class="card-title">Card title</h5>
    <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    <a href="#" class="card-link">Card link</a>
    <a href="#" class="card-link">Another link</a>

htmlNode.value = testHtml.trim()
parserNode.contentDocument.body.innerHTML = wrapHtmlInTestSlot(testHtml)

document.querySelector('#html').addEventListener('keyup', (e) => {
  parserNode.contentDocument.body.innerHTML = wrapHtmlInTestSlot(
  const { ast } = parseHtml(parserNode.contentDocument.body.firstChild)

  glueDomNode.value = generateCode(transformGeneratedAst(ast)).code

const { ast } = parseHtml(parserNode.contentDocument.body.firstChild)

glueDomNode.value = generateCode(transformGeneratedAst(ast)).code