From 6a7a9ebc85c18e06546f52e47f09fb192ee7914e Mon Sep 17 00:00:00 2001 From: MrMugame <40832361+MrMugame@users.noreply.github.com> Date: Wed, 9 Jul 2025 10:37:34 +0200 Subject: [PATCH] Adds missing doc for syscalls (#1452) * Add missing syscall documentation * Add missing space lua documentation --- plug-api/syscalls/markdown.ts | 5 +++++ website/API/markdown.md | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/plug-api/syscalls/markdown.ts b/plug-api/syscalls/markdown.ts index 90ff29e3..be8766f0 100644 --- a/plug-api/syscalls/markdown.ts +++ b/plug-api/syscalls/markdown.ts @@ -19,6 +19,11 @@ export function renderParseTree(tree: ParseTree): Promise { return syscall("markdown.renderParseTree", tree); } +/** + * Expands custom markdown Lua directives and transclusions into plain markdown + * @param tree the parse tree + * @returns the expaneded markdown + */ export function expandMarkdown(tree: ParseTree): Promise { return syscall("markdown.expandMarkdown", tree); } diff --git a/website/API/markdown.md b/website/API/markdown.md index a05e8f69..0998f65d 100644 --- a/website/API/markdown.md +++ b/website/API/markdown.md @@ -29,3 +29,26 @@ local tree = markdown.parseMarkdown(text) -- Modify tree if needed local rendered = markdown.renderParseTree(tree) print("Rendered markdown:", rendered) +``` + +### markdown.markdownToHtml(text) +Renders a piece of markdown text into HTML + +Example: +```lua +local text = "# Title\n\nSome text" +local html = markdown.markdownToHtml(text) +print("Rendered html:", html) +``` + +### markdown.expandMarkdown(tree) +Expands custom markdown Lua directives and transclusions into plain markdown inside a ParseTree + +Example: +```lua +local text = "This is a some lua ${os.time()}" +local tree = markdown.parseMarkdown(text) +local expandedTree = markdown.expandMarkdown(tree) +local rendered = markdown.renderParseTree(expandedTree) +print("Rendered markdown:", rendered) +``` \ No newline at end of file