Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
123456789101112131415161718import { isMarkdownFile } from "$lib/markup/format";import type { MarkupContext } from "$lib/markup/paths";import { SOURCE_LIMIT, renderMarkdown } from "$lib/markup/markdown";
const render = async (contents: string, ctx: MarkupContext): Promise<string | null> => { if (contents.length > SOURCE_LIMIT) return null; return `<div data-markup>${await renderMarkdown(contents, ctx)}</div>`;};
export const renderDocument = async ( filename: string, contents: string, ctx: MarkupContext): Promise<string | null> => (isMarkdownFile(filename) ? render(contents, ctx) : null);
export const renderMarkup = (contents: string, ctx: MarkupContext): Promise<string | null> => render(contents, { ...ctx, collapseCode: true });