From 10293f2f629116c801d3d40a20eeb3ac52e2861e Mon Sep 17 00:00:00 2001 From: Elara Musayelyan Date: Wed, 1 Nov 2023 00:23:27 -0700 Subject: [PATCH] Add code example to README --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 57c37e5..d2f9322 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [Salix](https://gitea.elara.ws/Elara6331/salix) tag for markdown rendering. -Example: +Template Example: ```markdown
@@ -12,3 +12,23 @@ Example: #!markdown
``` + +Code Example: + +```go +md := goldmark.New(goldmark.WithExtensions(extension.GFM)) + +tmpl, err := salix.New().ParseFile("example.txt") +if err != nil { + panic(err) +} + +err = tmpl. + WithTagMap(map[string]salix.Tag{ + "markdown": salixmd.New(md), + }). + Execute(os.Stdout) +if err != nil { + panic(err) +} +```