Skip to content

feat: export InsertionMode enum from parse5#1704

Open
TrevorBurnham wants to merge 1 commit intoinikulin:masterfrom
TrevorBurnham:export-insertion-mode
Open

feat: export InsertionMode enum from parse5#1704
TrevorBurnham wants to merge 1 commit intoinikulin:masterfrom
TrevorBurnham:export-insertion-mode

Conversation

@TrevorBurnham
Copy link
Copy Markdown
Contributor

Closes #531

Summary

Exports the InsertionMode enum so that consumers building custom parsers can check insertionMode against named values instead of magic numbers.

Changes

  • packages/parse5/lib/parser/index.ts — Changed enum InsertionMode to export enum InsertionMode with explicit numeric assignments to guarantee stable values across releases.
  • packages/parse5/lib/index.ts — Added InsertionMode to the re-export from ./parser/index.js.
  • packages/parse5/lib/parser/index.test.ts — Added a smoke test verifying the export exists and key values are stable.

Usage

import { InsertionMode } from 'parse5';

// Now you can reference InsertionMode.IN_BODY, InsertionMode.IN_TABLE, etc.
// instead of comparing against raw numeric values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider exporting InsertionMode enum

2 participants