Closed bep closed 8 months ago
The passthrough extension code looks great, and my original thought was that the minor points below doesn't matter, but since:
passthrough
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:
The passthrough package will never contain other things, so we might as well make it:
NewPassthroughBlockRenderer() renderer.NodeRenderer
NewBlockRenderer() renderer.NodeRenderer
NewPassthroughWithDelimiters
NewWithDelimiters
PassthroughInline struct
Inline struct
KindPassthroughBlock
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 { }
The passthrough extension code looks great, and my original thought was that the minor points below doesn't matter, but since:
passthrough
sets a standard for how future extension packages should look.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:NewPassthroughBlockRenderer() renderer.NodeRenderer
=>NewBlockRenderer() renderer.NodeRenderer
NewPassthroughWithDelimiters
=>NewWithDelimiters
PassthroughInline struct
=>Inline struct
.KindPassthroughBlock
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.
Becomes: