diff --git a/src/renderer/components/NotebookCell.tsx b/src/renderer/components/NotebookCell.tsx index f5e6ee0e..52eac66a 100644 --- a/src/renderer/components/NotebookCell.tsx +++ b/src/renderer/components/NotebookCell.tsx @@ -477,7 +477,7 @@ export default function NotebookCellView({ ) )} - {cell.cellType === 'code' && } + {cell.cellType === 'code' && } ) } diff --git a/src/renderer/components/NotebookOutputs.tsx b/src/renderer/components/NotebookOutputs.tsx index fc535d51..0b21437c 100644 --- a/src/renderer/components/NotebookOutputs.tsx +++ b/src/renderer/components/NotebookOutputs.tsx @@ -22,7 +22,17 @@ function TruncationNote(): React.ReactElement { ) } -function OutputBlock({ output }: { output: NotebookOutput }): React.ReactElement | null { +// Kernel HTML is sanitized (no scripts, no event handlers) and may not carry CSS: +// a
cover
' } + }] + const { container } = render() + expect(container.querySelector('style')).toBeNull() + expect(container.querySelector('[style]')).toBeNull() + expect(container.textContent).toContain('cover') + }) }) describe('markdown attachments', () => { @@ -88,6 +107,14 @@ describe('markdown attachments', () => { expect(resolveMarkdownAttachments('![a](attachment:x.png)', undefined)).toBe('![a](attachment:x.png)') }) + it('leaves attachment: references inside code alone', () => { + const source = 'see `attachment:checker.png`\n\n```\n![x](attachment:checker.png)\n```\n\n![y](attachment:checker.png)' + const out = resolveMarkdownAttachments(source, attachments) + expect(out).toContain('`attachment:checker.png`') + expect(out).toContain('```\n![x](attachment:checker.png)\n```') + expect(out).toContain(`![y](data:image/png;base64,${PNG})`) + }) + it('handles URL-encoded names', () => { const named = { 'my image.png': { 'image/png': PNG } } expect(resolveMarkdownAttachments('![a](attachment:my%20image.png)', named)).toContain('data:image/png;base64,')