diff options
| author | Olcan <[email protected]> | 2025-06-01 16:52:31 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-01 16:52:31 -0700 |
| commit | d00926780176604c030ba04fb4efb0f1a24c82cf (patch) | |
| tree | a4ab39800a1d8b1f2e6c25b27daf6aceef7100ba /packages/cli/src/ui/utils/MarkdownDisplay.tsx | |
| parent | 2828fc6d66cd7a74db231143183bd7c44e55148d (diff) | |
more strict italics: delimiters cannot be preceded/followed by \w or [./\\]\S (#677)
Diffstat (limited to 'packages/cli/src/ui/utils/MarkdownDisplay.tsx')
| -rw-r--r-- | packages/cli/src/ui/utils/MarkdownDisplay.tsx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/cli/src/ui/utils/MarkdownDisplay.tsx b/packages/cli/src/ui/utils/MarkdownDisplay.tsx index 83fb46ee..d93b5be2 100644 --- a/packages/cli/src/ui/utils/MarkdownDisplay.tsx +++ b/packages/cli/src/ui/utils/MarkdownDisplay.tsx @@ -231,9 +231,17 @@ const RenderInlineInternal: React.FC<RenderInlineProps> = ({ text }) => { </Text> ); } else if ( + fullMatch.length > ITALIC_MARKER_LENGTH * 2 && ((fullMatch.startsWith('*') && fullMatch.endsWith('*')) || (fullMatch.startsWith('_') && fullMatch.endsWith('_'))) && - fullMatch.length > ITALIC_MARKER_LENGTH * 2 + !/\w/.test(text.substring(match.index - 1, match.index)) && + !/\w/.test( + text.substring(inlineRegex.lastIndex, inlineRegex.lastIndex + 1), + ) && + !/\S[./\\]/.test(text.substring(match.index - 2, match.index)) && + !/[./\\]\S/.test( + text.substring(inlineRegex.lastIndex, inlineRegex.lastIndex + 2), + ) ) { renderedNode = ( <Text key={key} italic> |
