md-section
Get specific sections of markdown files based on headings.
const markdown = `
# My text
## Sub title 1
Content 1
## Sub title 2
Content 2
`;
const { getHeadlines, getSection } = require("md-sections");
const headlines = getHeadlines(markdown);
console.log(headlines);
console.log(getSection(markdown, headlines[1]));
Or limited by max/min levels:
const markdown = `
# My text
## Sub title 1
Content 1
### Sub sub title 1
Content 1.1
## Sub title 2
Content 2
`;
const { getHeadlines, getSection } = require("md-sections");
const headlines = getHeadlines(markdown, { minLevel: 2, maxLevel: 2 });
console.log(headlines);
console.log(getSection(markdown, headlines[1]));