fix(markdown): formatting inside bold/italic/strike, monochrome inline code
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m17s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m17s
Bold, italic and strikethrough render their inside again, so **`code`** shows bold code instead of backticks; inline code uses the theme's code background with the main text colour instead of the accent colour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
05355989a8
commit
e243e328c7
3 files changed
+15
-4
No files matched your search
@@ -10,6 +10,13 @@ describe('renderInlineMarkdown', () => {
|
||||
expect(strong?.textContent).toBe('fettem');
|
||||
});
|
||||
|
||||
it('renders inline code inside bold text', () => {
|
||||
const { container } = render(<div>{renderInlineMarkdown('Der Block **`services`** startet')}</div>);
|
||||
const code = container.querySelector('strong code');
|
||||
expect(code?.textContent).toBe('services');
|
||||
expect(container.textContent).toBe('Der Block services startet');
|
||||
});
|
||||
|
||||
it('renders italic text with <em> tag', () => {
|
||||
const { container } = render(<div>{renderInlineMarkdown('Text mit *kursivem* Wort')}</div>);
|
||||
const em = container.querySelector('em');
|
||||
|
||||
@@ -86,7 +86,7 @@ function renderInlineTokens(text: string, options?: InlineMarkdownOptions): Reac
|
||||
}
|
||||
} else if (token.startsWith('`') && token.endsWith('`')) {
|
||||
elements.push(
|
||||
<code key={key} className="px-1.5 py-0.5 rounded bg-panel-elevated text-accent font-mono text-[0.9em] border border-border/50">
|
||||
<code key={key} className="px-1.5 py-0.5 rounded bg-code text-main font-mono text-[0.9em] border border-border/50">
|
||||
{token.slice(1, -1)}
|
||||
</code>
|
||||
);
|
||||
@@ -96,7 +96,7 @@ function renderInlineTokens(text: string, options?: InlineMarkdownOptions): Reac
|
||||
) {
|
||||
elements.push(
|
||||
<strong key={key} className="font-semibold text-main">
|
||||
{token.slice(2, -2)}
|
||||
{renderInlineTokens(token.slice(2, -2), options)}
|
||||
</strong>
|
||||
);
|
||||
} else if (
|
||||
@@ -105,13 +105,13 @@ function renderInlineTokens(text: string, options?: InlineMarkdownOptions): Reac
|
||||
) {
|
||||
elements.push(
|
||||
<em key={key} className="italic text-main/90">
|
||||
{token.slice(1, -1)}
|
||||
{renderInlineTokens(token.slice(1, -1), options)}
|
||||
</em>
|
||||
);
|
||||
} else if (token.startsWith('~~') && token.endsWith('~~')) {
|
||||
elements.push(
|
||||
<del key={key} className="line-through text-muted/80">
|
||||
{token.slice(2, -2)}
|
||||
{renderInlineTokens(token.slice(2, -2), options)}
|
||||
</del>
|
||||
);
|
||||
} else if (token.startsWith('[') && match[2] && match[3] && safeHref(match[3])) {
|
||||
|
||||
Reference in new issue
Block a user