Skip to content

add_render_rule should give some kind of warning for attempting to add a rule with a non-existant name. #308

Open
@MisterEggnog

Description

@MisterEggnog

Context

While working on a plugin for markdown_it I did not understand the purpose of the name argument to MarkdownIt.add_render_rule, this was not helped that as best I could tell said argument had no clear purpose, (the fact that the docstring gives no information does not help either,) because of this I spent time troubleshooting why my rule was never being invoked.

Proposal

The simplest solution I think would be to include in add_render_rule or whatever part in the code that lookups the name, to log a warning if name is not one of the preset rules. I think pythons logger.warning would likely be suitable for this.

It may also be helpful to note that name must be a preset rule in the docstring for MarkdownIt.add_render_rule.

Tasks and updates

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions