KScript docs
EN

KScript.Markdown

Markdown to HTML, with front matter.

Import it at the top of a script:

<import package="KScript.Markdown" />
import KScript.Markdown

Commands

Commands are called with @, in any expression: @name(arguments).

#@markdown(text) → map

Renders Markdown: $doc.html, $doc.title, $doc.meta (front matter) and $doc.text.
Example
<import package="KScript.Markdown" />
<let name="post" value="@markdown('# Hello *world*')" />
<echo>{ $post.title }: { $post.html }</echo>
import KScript.Markdown
$post = @markdown('# Hello *world*')
echo "{ $post.title }: { $post.html }"

#@read_markdown(path) → map

Reads a Markdown file: $doc.html, $doc.title, $doc.meta (front matter) and $doc.text. Relative paths are from the script's folder.
Example
<let name="post" value="@read_markdown('posts/hello.md')" />
$post = @read_markdown('posts/hello.md')

Methods

On string values: ->highlight(), ->markdown_escape()