diff --git a/packages/ui/components/Viewer.tsx b/packages/ui/components/Viewer.tsx index 9e8e7e6..ecbb8a4 100644 --- a/packages/ui/components/Viewer.tsx +++ b/packages/ui/components/Viewer.tsx @@ -836,6 +836,25 @@ const InlineMarkdown: React.FC<{ text: string; onOpenLinkedDoc?: (path: string) continue; } + // Hex color swatch — 3/4-digit forms need an a-f letter to avoid matching issue refs like #123. + match = remaining.match(/^(#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|(?=[0-9a-fA-F]*[a-fA-F])[0-9a-fA-F]{4}|(?=[0-9a-fA-F]*[a-fA-F])[0-9a-fA-F]{3}))(?![0-9a-fA-F\w])/); + if (match) { + const hex = match[1]; + parts.push( + + + {hex} + + ); + remaining = remaining.slice(match[0].length); + previousChar = match[0][match[0].length - 1] || previousChar; + continue; + } + // Wikilinks: [[filename]] or [[filename|display text]] match = remaining.match(/^\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/); if (match) { @@ -972,7 +991,7 @@ const InlineMarkdown: React.FC<{ text: string; onOpenLinkedDoc?: (path: string) } // Find next special character or consume one regular character - const nextSpecial = remaining.slice(1).search(/[\*_`\[!~\\<]/); + const nextSpecial = remaining.slice(1).search(/[\*_`\[!~\\<#]/); if (nextSpecial === -1) { parts.push(remaining); previousChar = remaining[remaining.length - 1] || previousChar;