mirror of
https://github.com/davidkaya/aryx.git
synced 2026-11-28 03:22:47 +01:00
feat: add markdown composer backend foundation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
a8c6ba94f5
commit
d07bf30e81
16 files changed
+539
-121
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { describe, expect, test } from 'bun:test';
|
||||
|
||||
import { buildMarkdownExcerpt, extractPlainTextFromMarkdown } from '@shared/utils/markdownText';
|
||||
|
||||
describe('markdown text helpers', () => {
|
||||
test('extracts readable text from common markdown syntax', () => {
|
||||
expect(
|
||||
extractPlainTextFromMarkdown('# Title\n\n**Bold** [Docs](https://example.com) and `code`.'),
|
||||
).toBe('Title Bold Docs and code.');
|
||||
});
|
||||
|
||||
test('turns fenced code blocks into readable excerpts', () => {
|
||||
expect(buildMarkdownExcerpt('```ts\nconst answer = 42;\n```', 48)).toBe('const answer = 42;');
|
||||
});
|
||||
|
||||
test('truncates after stripping markdown syntax', () => {
|
||||
expect(buildMarkdownExcerpt('**Alpha** beta gamma delta epsilon zeta eta theta', 18)).toBe(
|
||||
'Alpha beta gamma d…',
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user