mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-09-24 15:49:09 +00:00
b02d52516c
messageResponse pulled @streamdown/code on first markdown import, so opening a chat with history paid for the full highlighter even when the reply was just prose. Render with CJK only first. When a fence exists and the composer is idle, lazily import the isolated Shiki plugin.
14 lines
578 B
TypeScript
14 lines
578 B
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
|
|
import { hasMarkdownCodeFence } from './hasMarkdownCodeFence';
|
|
|
|
test('detects common markdown fences', () => {
|
|
assert.equal(hasMarkdownCodeFence('hello'), false);
|
|
assert.equal(hasMarkdownCodeFence('use `code` inline'), false);
|
|
assert.equal(hasMarkdownCodeFence('```ts\nconst a = 1\n```'), true);
|
|
assert.equal(hasMarkdownCodeFence('prefix\n```\nplain\n```'), true);
|
|
assert.equal(hasMarkdownCodeFence('~~~\nbash\n~~~'), true);
|
|
assert.equal(hasMarkdownCodeFence(' ```json\n{}\n```'), true);
|
|
});
|