Skip to content

Extract addDefuddleRules for standalone TurndownService usage#190

Open
shfshanyue wants to merge 1 commit intokepano:mainfrom
shfshanyue:main
Open

Extract addDefuddleRules for standalone TurndownService usage#190
shfshanyue wants to merge 1 commit intokepano:mainfrom
shfshanyue:main

Conversation

@shfshanyue
Copy link

Extract Turndown rule registration logic into a standalone addDefuddleRules(turndownService) function, allowing users to apply Defuddle's custom markdown rules to their own TurndownService instances with custom options.

Previously, the only way to get Defuddle's markdown rules was through createMarkdownContent. This change enables consumers to bring their own TurndownService configuration (e.g., headingStyle: 'setext', bulletListMarker: '*') while still leveraging Defuddle's rule set.

- Introduced addDefuddleRules to register custom rules for TurndownService.
- Updated createMarkdownContent to utilize addDefuddleRules.
- Exported addDefuddleRules from index.full.ts for external use.
- Added tests for addDefuddleRules to ensure proper functionality.
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.

1 participant