Skip to content

Instantly share code, notes, and snippets.

@looio
Created October 24, 2013 07:00
Show Gist options
  • Save looio/7132536 to your computer and use it in GitHub Desktop.
Save looio/7132536 to your computer and use it in GitHub Desktop.
check if the paragraph start with how many %
function processParagraph(paragraph) {
var header = 0;
while (paragraph.charAt(header) == "%")
header++;
if (header > 0)
return {type: "h" + header, content: paragraph.slice(header + 1)};
else
return {type: "p", content: paragraph};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment