Skip to content

Commit

Permalink
readme: Update passthrough example
Browse files Browse the repository at this point in the history
  • Loading branch information
jmooring authored and bep committed Mar 15, 2024
1 parent dac9132 commit 998eef2
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,38 @@ import (
)

func main() {
inlineDelimiters := []passthrough.Delimiters{
{Open: "\\(", Close: "\\)"},
}
blockDelimiters := []passthrough.Delimiters{
{Open: "\\[", Close: "\\]"},
{Open: "$$", Close: "$$"},
}

md := goldmark.New(
goldmark.WithExtensions(
passthrough.NewPassthroughWithDelimiters(
inlineDelimiters,
blockDelimiters,
passthrough.New(
passthrough.Config{
InlineDelimiters: []passthrough.Delimiters{
{
Open: "$",
Close: "$",
},
{
Open: "\\(",
Close: "\\)",
},
},
BlockDelimiters: []passthrough.Delimiters{
{
Open: "$$",
Close: "$$",
},
{
Open: "\\[",
Close: "\\]",
},
},
},
)),
)

input := `
block \[a^*=x-b^*\] snippet
block $$a^*=x-b^*$$ snippet
inline \(a^*=x-b^*\) snippet
inline $a^*=x-b^*$ snippet
`

var buf bytes.Buffer
Expand Down

0 comments on commit 998eef2

Please sign in to comment.