Skip to content

Support root visitor on plugins #164

Description

@fuma-nama

What's the problem?

For example, if my mdast/hdast plugin will generate esm export: export const toc = [...] based on the heading it visited. When a document has no heading, it will never be triggered, thus no export generated. Under this case, there's no simple way to "run exactly once", or "run at least once".

Previously, it's done by directly injecting it after visit, but Satteri plugins don't have this concept.

What's the proposed solution?

Support a root visitor, it will run exactly once for every document, even if empty.

Participation

  • I am willing to submit a pull request for this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions