diff --git a/src/generators/metadata/constants.mjs b/src/generators/metadata/constants.mjs index e8ac140b..d9cbd2d8 100644 --- a/src/generators/metadata/constants.mjs +++ b/src/generators/metadata/constants.mjs @@ -7,9 +7,9 @@ export const DOC_API_SLUGS_REPLACEMENTS = [ { from: /node.js/i, to: 'nodejs' }, // Replace Node.js { from: /&/, to: '-and-' }, // Replace & { from: /[/,:;\\ ]/g, to: '-' }, // Replace /,:;\. and whitespace - { from: /^-+(?!-*$)/g, to: '' }, // Remove any leading hyphens + { from: /^-(?=[^-])/g, to: '' }, // Remove a single leading hyphen (preserves -- prefix for CLI flags) { from: /(? { assert.strictEqual(slug('-foo', identity), 'foo'); }); - it('removes multiple leading hyphens', () => { - assert.strictEqual(slug('--foo', identity), 'foo'); + it('preserves double leading hyphens (CLI flag prefix)', () => { + assert.strictEqual(slug('--foo', identity), '--foo'); }); it('preserves an all-hyphen string', () => {