mirror of
https://github.com/docmost/docmost.git
synced 2025-11-14 05:11:12 +10:00
📝 Add docstrings to feat/typst
Docstrings generation was requested by @Vito0912. * https://github.com/docmost/docmost/pull/1652#issuecomment-3353711947 The following files were modified: * `apps/client/src/features/editor/components/typst/typst-block.tsx` * `apps/client/src/features/editor/components/typst/typst-menu.tsx` * `apps/client/src/features/editor/page-editor.tsx` * `apps/server/src/collaboration/collaboration.util.ts` * `packages/editor-ext/src/lib/markdown/utils/marked.utils.ts`
This commit is contained in:
committed by
GitHub
parent
3135030376
commit
035e21e211
@ -33,12 +33,14 @@ import {
|
||||
Embed,
|
||||
Mention,
|
||||
Subpages,
|
||||
TypstBlock,
|
||||
} from '@docmost/editor-ext';
|
||||
import { generateText, getSchema, JSONContent } from '@tiptap/core';
|
||||
import { generateHTML, generateJSON } from '../common/helpers/prosemirror/html';
|
||||
import { generateHTML } from '../common/helpers/prosemirror/html';
|
||||
// @tiptap/html library works best for generating prosemirror json state but not HTML
|
||||
// see: https://github.com/ueberdosis/tiptap/issues/5352
|
||||
// see:https://github.com/ueberdosis/tiptap/issues/4089
|
||||
import { generateJSON } from '@tiptap/html';
|
||||
import { Node } from '@tiptap/pm/model';
|
||||
|
||||
export const tiptapExtensions = [
|
||||
@ -80,8 +82,15 @@ export const tiptapExtensions = [
|
||||
Embed,
|
||||
Mention,
|
||||
Subpages,
|
||||
TypstBlock,
|
||||
] as any;
|
||||
|
||||
/**
|
||||
* Convert a Tiptap JSON document to HTML.
|
||||
*
|
||||
* @param tiptapJson - Tiptap-compatible JSON document (editor state/content)
|
||||
* @returns An HTML string representing the provided document
|
||||
*/
|
||||
export function jsonToHtml(tiptapJson: any) {
|
||||
return generateHTML(tiptapJson, tiptapExtensions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user