Some checks failed
CD / Build and push images (push) Successful in 1m50s
CI / Lint, typecheck, test (push) Failing after 52s
CI / Auth e2e pack (push) Successful in 1m47s
CI / Build container images (push) Has been skipped
CD / Deploy to Test (push) Successful in 8s
CD / Smoke tests against Test (push) Successful in 1m5s
CD / Promote to Int (push) Successful in 10s
ProseMirror schema (headings 1-4, lists incl. task lists, blockquote, code block, tables via prosemirror-tables, images, hard breaks; bold/ italic/code/strikethrough/link marks) plus docToMarkdown, markdownToDoc, docToPlainText, docToHtml, and extractOutline built on it. Markdown parsing extends markdown-it's default preset with a token-stream transform for GFM task lists and table-cell paragraph wrapping. docToHtml hand-rolls escaping and link-protocol allowlisting with zero DOM dependencies, so it runs in the API/collab server as well as the browser. Node names `wikilink` and `plugin_block` are reserved for later stories. Closes #24
17 lines
603 B
TypeScript
17 lines
603 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { markdownToDoc } from './markdown';
|
|
import { docToPlainText } from './plain-text';
|
|
|
|
describe('docToPlainText (issue #24)', () => {
|
|
it('strips formatting and joins blocks with blank lines', () => {
|
|
const doc = markdownToDoc('# Title\n\nA **bold** paragraph.\n\n- One\n- Two');
|
|
expect(docToPlainText(doc)).toBe('Title\n\nA bold paragraph.\n\nOne\n\nTwo');
|
|
});
|
|
|
|
it('falls back to alt text for images', () => {
|
|
const doc = markdownToDoc('');
|
|
expect(docToPlainText(doc)).toBe('A pond at dusk');
|
|
});
|
|
});
|