generated from bep/golibtemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Description
The passthrough extension code looks great, and my original thought was that the minor points below doesn't matter, but since:
- This
passthroughsets a standard for how future extension packages should look. - Public API is hard(er) to change after people start using it.
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.NodeRendererNewPassthroughWithDelimiters=>NewWithDelimitersPassthroughInline struct=>Inline struct.- ... others where relevant, but keeping it in identifiers such as
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.
func NewPassthroughWithDelimiters(
InlineDelimiters []Delimiters,
BlockDelimiters []Delimiters) goldmark.Extender {
}Becomes:
func New(c Config) goldmark.Extender {
}Metadata
Metadata
Assignees
Labels
No labels