Skip to content

Conversation

@natemoo-re
Copy link
Member

Refactors tct to include built-in shortcodes ('code' | 'link' | 'strong' | 'break' | 'bold' | 'italic' | 'em') based on common usage and enforce type-safety for custom shortcodes.

With this, the tctCode can be deprecated and tct('Use [code:value]', { code: <code /> }) becomes tct('Use [code:value]').

Usage will be migrated in a separate PR.

- Add TypeScript type system to extract shortcodes from template strings
- Implement SmartLink component for auto-routing internal/external links
- Add DEFAULT_COMPONENTS with built-in support for [code], [link], [strong], [bold], [italic], [break]
- Update gettextComponentTemplate to merge defaults with user components
- Deprecate tctCode function in favor of enhanced tct
- Maintain 100% backward compatibility
- Add unit tests for all 6 built-in shortcodes ([code], [link], [strong], [bold], [italic], [break])
- Test component override functionality
- Test nested shortcode support
- Test mixed built-in and custom shortcodes
- Add type-level tests to verify compile-time enforcement
- Verify backward compatibility with existing usage
- Use InlineCode component for [code] shortcode
- Normalize [bold] to <strong> element
- Normalize [italic] to <em> element
- Add [em] as explicit shortcode option
- Update BuiltInShortcodes type to include 'em'
- Update [code] tests to expect InlineCode component (with styling)
- Update [bold] tests to reflect normalization to <strong>
- Update [italic] tests to reflect normalization to <em>
- Add test for new [em] shortcode
- Make assertions more flexible for styled components
- Import InlineCode directly from @sentry/scraps/code/inlineCode
- Avoids circular dependency through CodeBlock component
- Keeps InlineCode styling for [code] shortcode
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants