gohugoio / hugo-goldmark-extensions

Work in progress.
Apache License 2.0
18 stars 5 forks source link

passthrough: Some minor API adjustments #8

Closed bep closed 7 months ago

bep commented 8 months ago

The passthrough extension code looks great, and my original thought was that the minor points below doesn't matter, but since:

But note: There's no rush in doing this; Hugo is currently the only user of this, and that's an easy upgrade.

There's 2 suggested improvements:

1. Avoid repeating the package name in types and funcs

The passthrough package will never contain other things, so we might as well make it:

2. Add a config struct to the main New func

Over time, there will always be a need for additional configuration, so we might as well prepare for it.

func NewPassthroughWithDelimiters(
    InlineDelimiters []Delimiters,
    BlockDelimiters []Delimiters) goldmark.Extender {
}

Becomes:

func New(c Config) goldmark.Extender {
}