Skip to content

Allow rules to provide a "priority" (integer), for sorting rule order? #24

Open
@chrisjsewell

Description

@chrisjsewell

Currently, it can be a bit confusing to understand in which order rules will be applied, and how they are "inter-connected"

For example, if you have a plugin like:

pub fn add(md: &mut MarkdownIt) {
    md.add_rule::<MyRule1>()
        .before::<MyRule2>()
        .after::<MyRule3>();
        .before_all();
}

For RST, in docutils, they have the rough equivalence (for core rules) of transforms, that specify a priority by which they are sorted: https://docutils.sourceforge.io/docs/ref/transforms.html#transform-priority-range-categories
and, building on this, sphinx then allows transform plugins: https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_transform

It feels this might be an easier way to deal with rule ordering?

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