Skip to content

Instantly share code, notes, and snippets.

@13protons
Last active August 29, 2015 14:06
Show Gist options
  • Save 13protons/fdec1d4a3fdefa6ff17a to your computer and use it in GitHub Desktop.
Save 13protons/fdec1d4a3fdefa6ff17a to your computer and use it in GitHub Desktop.
Deckdown parsing

The deckdown regex parser should be able to break up a document by headers. For example this input html fragment:

<h1>Section</h1>
<p>Section Info</p>

<h2>Section</h2>
<p>Section Info</p>

<h1>Section<h1>
<p>Section</p>
<ul>
  <li>Something</li>
  <li>Something</li>
<ul>

Should yield this array of html fragments:

[
  '<h1>Section</h1><p>Section Info</p>',
  '<h2>Section</h2><p>Section Info</p>',
  '<h1>Section<h1><p>Section</p><ul><li>Something</li><li>Something</li><ul>'
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment