Skip to content

Instantly share code, notes, and snippets.

@jrolfs
Created August 31, 2017 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrolfs/d10612665fcdd4bda28acf1a332fee13 to your computer and use it in GitHub Desktop.
Save jrolfs/d10612665fcdd4bda28acf1a332fee13 to your computer and use it in GitHub Desktop.
const tree = markdown.parse(fs.readFileSync('README.md', 'utf8'));
const taskOptions = lodash.chain(tree)
.transform((memo, node) => {
if (memo.section && memo.list) {
} else if (node[0] === 'header' && node[1].level === 2 && node[2].match(/Making/)) {
memo.section = true;
} else if (node[0] === 'header' && node[1].level === 5 && node[2].match(/Options/)) {
memo.list = true;
}
return memo;
}, { nodes: [], section: false, list: false });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment