Add code example to README
This commit is contained in:
parent
22dc81f447
commit
10293f2f62
22
README.md
22
README.md
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[Salix](https://gitea.elara.ws/Elara6331/salix) tag for markdown rendering.
|
[Salix](https://gitea.elara.ws/Elara6331/salix) tag for markdown rendering.
|
||||||
|
|
||||||
Example:
|
Template Example:
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
<div>
|
<div>
|
||||||
@ -12,3 +12,23 @@ Example:
|
|||||||
#!markdown
|
#!markdown
|
||||||
</div>
|
</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)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user