feat: add support for custom tag types - #368
Merged
Merged
Conversation
- Remove unused variable in compileBody - Use JSON.stringify for safe escaping of tag type and content - Add missing semicolon in parse.ts - Restore original ternary style for tag type resolution - Add tests for custom tags
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #368 +/- ##
==========================================
+ Coverage 92.15% 92.35% +0.20%
==========================================
Files 11 11
Lines 293 301 +8
Branches 78 81 +3
==========================================
+ Hits 270 278 +8
Misses 9 9
Partials 14 14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Use Object.hasOwn instead of `in` operator for custom tag lookup - Throw on custom tag prefixes that conflict with built-in prefixes or trim markers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
customTagsconfig option for defining custom tag prefixes with handler functionsUsage
Changes
src/config.ts— addcustomTagstoEtaConfigwith default{}src/parse.ts— include custom tag prefixes in the parser regex, set tag type to the prefix stringsrc/compile-string.ts— dispatch custom tag types incompileBodyviathis.config.customTagstest/render.spec.ts— 4 tests (basic lookup, comment, multiple tags, mixed with built-in tags)Test plan
pnpm format,pnpm lint,pnpm buildall cleanCloses #364