Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
|
|
3 years ago | |
|---|---|---|
| .. | ||
| .gitignore | 3 years ago | |
| LICENSE | 3 years ago | |
| README.md | 3 years ago | |
| go.mod | 3 years ago | |
| go.sum | 3 years ago | |
| highlighting.go | 3 years ago | |
goldmark-highlighting is an extension for the goldmark
that adds syntax-highlighting to the fenced code blocks.
goldmark-highlighting uses chroma as a
syntax highlighter.
go get github.com/yuin/goldmark-highlighting
import (
"bytes"
"fmt"
"github.com/alecthomas/chroma/formatters/html"
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/extension"
"github.com/yuin/goldmark/parser"
"github.com/yuin/goldmark-highlighting"
)
func main() {
markdown := goldmark.New(
goldmark.WithExtensions(
highlighting.Highlighting,
),
)
var buf bytes.Buffer
if err := markdown.Convert([]byte(source), &buf); err != nil {
panic(err)
}
fmt.Print(title)
}
markdown := goldmark.New(
goldmark.WithExtensions(
highlighting.NewHighlighting(
highlighting.WithStyle("monokai"),
highlighting.WithFormatOptions(
html.WithLineNumbers(),
),
),
),
)
MIT
Yusuke Inuzuka
No Description
Go SVG JavaScript Vue Roff other