Move src/ → apps/server/ and packages/web/ → apps/web/ to adopt standard monorepo conventions (apps/ for runnable apps, packages/ for reusable libraries). Update all config files, shared package imports, test fixtures, and documentation to reflect new paths. Key fixes: - Update workspace config to ["apps/*", "packages/*"] - Update tsconfig.json rootDir/include for apps/server/ - Add apps/web/** to vitest exclude list - Update drizzle.config.ts schema path - Fix ensure-schema.ts migration path detection (3 levels up in dev, 2 levels up in dist) - Fix tests/integration/cli-server.test.ts import paths - Update packages/shared imports to apps/server/ paths - Update all docs/ files with new paths
33 lines
846 B
TypeScript
33 lines
846 B
TypeScript
/**
|
|
* Server-side Markdown → Tiptap JSON converter.
|
|
*
|
|
* Uses @tiptap/markdown's MarkdownManager.parse() — the same approach
|
|
* as content-serializer.ts but in reverse direction.
|
|
* No DOM needed, no new dependencies.
|
|
*/
|
|
|
|
import StarterKit from '@tiptap/starter-kit';
|
|
import Link from '@tiptap/extension-link';
|
|
import { MarkdownManager } from '@tiptap/markdown';
|
|
|
|
let _manager: MarkdownManager | null = null;
|
|
|
|
function getManager(): MarkdownManager {
|
|
if (!_manager) {
|
|
_manager = new MarkdownManager({
|
|
extensions: [StarterKit, Link],
|
|
});
|
|
}
|
|
return _manager;
|
|
}
|
|
|
|
/**
|
|
* Convert a markdown string to Tiptap JSON document.
|
|
*/
|
|
export function markdownToTiptapJson(markdown: string): object {
|
|
if (!markdown.trim()) {
|
|
return { type: 'doc', content: [{ type: 'paragraph' }] };
|
|
}
|
|
return getManager().parse(markdown);
|
|
}
|