mirror of
https://github.com/facundoolano/jorge.git
synced 2024-11-16 07:47:40 +01:00
Enable markdown extensions (#46)
* add footnote to markdow example * add footnote markdown extension * add gfm extensions
This commit is contained in:
parent
2b683af346
commit
2f5b468f73
2 changed files with 19 additions and 4 deletions
|
@ -22,4 +22,14 @@ def hello():
|
||||||
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.
|
[Next time](./hello-org), I'll talk about org-mode posts.
|
||||||
|
|
||||||
|
[^1]: apparently it would?
|
||||||
|
|
|
@ -18,6 +18,7 @@ import (
|
||||||
"github.com/osteele/liquid"
|
"github.com/osteele/liquid"
|
||||||
"github.com/yuin/goldmark"
|
"github.com/yuin/goldmark"
|
||||||
gm_highlight "github.com/yuin/goldmark-highlighting/v2"
|
gm_highlight "github.com/yuin/goldmark-highlighting/v2"
|
||||||
|
"github.com/yuin/goldmark/extension"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -169,10 +170,14 @@ func (templ Template) RenderWith(context map[string]interface{}, hlTheme string)
|
||||||
|
|
||||||
options := make([]goldmark.Option, 0)
|
options := make([]goldmark.Option, 0)
|
||||||
if hlTheme != NO_SYNTAX_HIGHLIGHTING {
|
if hlTheme != NO_SYNTAX_HIGHLIGHTING {
|
||||||
options = append(options, goldmark.WithExtensions(gm_highlight.NewHighlighting(
|
|
||||||
gm_highlight.WithStyle(hlTheme),
|
options = append(options, goldmark.WithExtensions(
|
||||||
gm_highlight.WithFormatOptions(html.TabWidth(CODE_TABWIDTH)),
|
extension.GFM,
|
||||||
)))
|
extension.Footnote,
|
||||||
|
gm_highlight.NewHighlighting(
|
||||||
|
gm_highlight.WithStyle(hlTheme),
|
||||||
|
gm_highlight.WithFormatOptions(html.TabWidth(CODE_TABWIDTH)),
|
||||||
|
)))
|
||||||
}
|
}
|
||||||
md := goldmark.New(options...)
|
md := goldmark.New(options...)
|
||||||
if err := md.Convert(content, &buf); err != nil {
|
if err := md.Convert(content, &buf); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue