diff --git a/apps/desktop/src/lib/artifact-detect.test.ts b/apps/desktop/src/lib/artifact-detect.test.ts index d4aba79129..a5a250b5d3 100644 --- a/apps/desktop/src/lib/artifact-detect.test.ts +++ b/apps/desktop/src/lib/artifact-detect.test.ts @@ -78,6 +78,13 @@ describe('detectArtifact', () => { expect(detectArtifact('markdown', longCode(80))).toBeNull() expect(detectArtifact('mermaid', longCode(80))).toBeNull() }) + + it('leaves rich-renderer fences alone however long they get', () => { + // Detection runs before the rich-fence registry, so a long `listing` set + // (or any renderer-owned language) would otherwise be stolen by the code + // card and never render as its own component. + expect(detectArtifact('listing', longCode(200))).toBeNull() + }) }) describe('artifactSlug', () => { diff --git a/apps/desktop/src/lib/artifact-detect.ts b/apps/desktop/src/lib/artifact-detect.ts index 464b92b6a9..8a25234103 100644 --- a/apps/desktop/src/lib/artifact-detect.ts +++ b/apps/desktop/src/lib/artifact-detect.ts @@ -34,11 +34,15 @@ const CODE_MIN_CHARS = 3000 const HTML_LANGUAGES = new Set(['html', 'htm', 'xhtml']) // Languages whose fences are never artifacts: prose-ish, terminal output, and -// the fences already owned by richer renderers (mermaid diagrams, small svg). +// the fences already owned by richer renderers (mermaid diagrams, small svg, +// listing cards). Artifact detection runs BEFORE the rich-fence registry, so a +// language that has its own renderer must opt out here or a long enough fence +// gets promoted to a code card and never reaches it. const NON_ARTIFACT_LANGUAGES = new Set([ '', 'console', 'diff', + 'listing', 'log', 'logs', 'markdown',