Enable markdown extensions (#46)

* add footnote to markdow example

* add footnote markdown extension

* add gfm extensions
This commit is contained in:
Facundo Olano 2024-09-12 12:58:56 -03:00 committed by GitHub
parent 2b683af346
commit 2f5b468f73
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 4 deletions

View file

@ -22,4 +22,14 @@ def hello():
hello()
```
Let's try some gfm extensions. This is ~~strikethrough~~.
| foo | bar |
| --- | --- |
| baz | bim |
Would it support footnotes[^1]?
[Next time](./hello-org), I'll talk about org-mode posts.
[^1]: apparently it would?

View file

@ -18,6 +18,7 @@ import (
"github.com/osteele/liquid"
"github.com/yuin/goldmark"
gm_highlight "github.com/yuin/goldmark-highlighting/v2"
"github.com/yuin/goldmark/extension"
"gopkg.in/yaml.v3"
)
@ -169,10 +170,14 @@ func (templ Template) RenderWith(context map[string]interface{}, hlTheme string)
options := make([]goldmark.Option, 0)
if hlTheme != NO_SYNTAX_HIGHLIGHTING {
options = append(options, goldmark.WithExtensions(gm_highlight.NewHighlighting(
gm_highlight.WithStyle(hlTheme),
gm_highlight.WithFormatOptions(html.TabWidth(CODE_TABWIDTH)),
)))
options = append(options, goldmark.WithExtensions(
extension.GFM,
extension.Footnote,
gm_highlight.NewHighlighting(
gm_highlight.WithStyle(hlTheme),
gm_highlight.WithFormatOptions(html.TabWidth(CODE_TABWIDTH)),
)))
}
md := goldmark.New(options...)
if err := md.Convert(content, &buf); err != nil {