1
0
silverbullet/common/syscalls/markdown.ts

17 lines
566 B
TypeScript

import {SysCallMapping} from "../../plugos/system";
import {MarkdownTree, nodeAtPos, parse, render} from "../tree";
export function markdownSyscalls(): SysCallMapping {
return {
"markdown.parse": (ctx, text: string): MarkdownTree => {
return parse(text);
},
"markdown.nodeAtPos": (ctx, mdTree: MarkdownTree, pos: number): MarkdownTree | null => {
return nodeAtPos(mdTree, pos);
},
"markdown.render": (ctx, mdTree: MarkdownTree): string => {
return render(mdTree);
},
};
}