aboutsummaryrefslogtreecommitdiff
path: root/mardown/eval.go
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2025-10-02 15:06:42 +0200
committerAnhgelus Morhtuuzh <william@herges.fr>2025-10-02 15:06:42 +0200
commit21dd71949b05d84ef6ee2f05610ec7254f1086f0 (patch)
tree72f94b52067774eed8264c5468b3b8a32b8553ef /mardown/eval.go
parentbe4cea404c15979112653cd4d75784aab527f22c (diff)
feat(markdown): custom error display
Diffstat (limited to 'mardown/eval.go')
-rw-r--r--mardown/eval.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/mardown/eval.go b/mardown/eval.go
new file mode 100644
index 0000000..c085767
--- /dev/null
+++ b/mardown/eval.go
@@ -0,0 +1,16 @@
+package mardown
+
+import "html/template"
+
+func Parse(s string) (template.HTML, *ParseError) {
+ lxs := lex(s)
+ tree, err := ast(lxs)
+ if err != nil {
+ return "", err
+ }
+ return tree.Eval()
+}
+
+func ParseBytes(b []byte) (template.HTML, *ParseError) {
+ return Parse(string(b))
+}