Add code example to README

This commit is contained in:
Elara 2023-11-01 00:23:27 -07:00
parent 22dc81f447
commit 10293f2f62

View File

@ -2,7 +2,7 @@
[Salix](https://gitea.elara.ws/Elara6331/salix) tag for markdown rendering.
Example:
Template Example:
```markdown
<div>
@ -12,3 +12,23 @@ Example:
#!markdown
</div>
```
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)
}
```