Skip to content

passthrough: Some minor API adjustments #8

@bep

Description

@bep

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

  • This passthrough sets 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.NodeRenderer
  • NewPassthroughWithDelimiters => NewWithDelimiters
  • PassthroughInline 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions