diff --git a/workspace/aubade/src/core/index.js b/workspace/aubade/src/core/index.js index 9ee2861..ec61cde 100644 --- a/workspace/aubade/src/core/index.js +++ b/workspace/aubade/src/core/index.js @@ -29,7 +29,7 @@ export function parse(source) { get table() { /** @type {import('../types.js').AubadeTable[]} */ const table = []; - for (const line of stuffed.split('\n')) { + for (const line of stuffed.replace(//g, '').split('\n')) { const match = line.trim().match(/^(#{2,4}) (.+)/); if (!match) continue; diff --git a/workspace/aubade/src/core/index.spec.js b/workspace/aubade/src/core/index.spec.js index af4b5cf..8027540 100644 --- a/workspace/aubade/src/core/index.spec.js +++ b/workspace/aubade/src/core/index.spec.js @@ -349,6 +349,29 @@ something here title: 'sub-plot', }); }); +suites['construct/table']('trim comments correctly', () => { + const { metadata } = core.parse( + ` +--- +title: headings inside comments +--- + +## simple heading + +### story + + + +### sub-story + +### sub-plot + `.trim(), + ); + + assert.equal(metadata.table.length, 4); +}); suites['parse/']('parse markdown contents', () => { const { body, metadata } = core.parse(