Skip to content

Instantly share code, notes, and snippets.

@evan-brass
Created December 25, 2020 22:47
Show Gist options
  • Save evan-brass/404720a9fe2fff8aa9e89413a6f9c58d to your computer and use it in GitHub Desktop.
Save evan-brass/404720a9fe2fff8aa9e89413a6f9c58d to your computer and use it in GitHub Desktop.
// Parse an open tag
const success = pull(/^<([a-zA-Z][a-zA-Z0-9\-]*)/, tag => {
const new_tag = { tag, attributes: {}, children: [] };
cursor.children.push(new_tag);
parse_attributes(new_tag);
if (!VOID_TAGS.includes(tag.toLowerCase())) {
parse_content(new_tag);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment