Simplify named rule extraction

AI-assisted by OpenAI Codex under maintainer pbakaus's scheduled-refactor authorization.
This commit is contained in:
Paul Bakaus
2026-08-31 12:59:53 -07:00
parent b0594c72d1
commit f1e8d4e70e
2 changed files with 45 additions and 30 deletions
+27
View File
@@ -228,6 +228,33 @@ describe('parseDesignMd overview branch', () => {
});
});
describe('parseDesignMd named rules', () => {
it('preserves format precedence while deduplicating later definitions', () => {
const md = `# Design System: Rules
## Layout
### The "Rhythm" Rule
Ignore this duplicate heading definition.
### The Fallback Principle
Use the heading definition.
### Named Rules
- **The Fallback Principle:** Ignore this duplicate bullet definition.
- **The Layering Principle:** Use the bullet definition.
**The Rhythm Rule.** Keep the first definition.
`;
assert.deepEqual(parseDesignMd(md).layout.rules, [
{ name: 'The Rhythm Rule', body: 'Keep the first definition.' },
{ name: 'The Fallback Principle', body: 'Use the heading definition.' },
{ name: 'The Layering Principle', body: 'Use the bullet definition.' },
]);
});
});
describe('parseDesignMd canonical sections', () => {
it('preserves content and named rules from all eight canonical sections', () => {
const md = `# Design System: Complete