miyuchina / mistletoe

A fast, extensible and spec-compliant Markdown parser in pure Python.
MIT License
841 stars 119 forks source link

Allow numerals in custom token class names #228

Open TheCodeForge opened 1 month ago

TheCodeForge commented 1 month ago

Updates the snake regex used to convert custom token class names to render function names, to allow for the use of numerals.

Example use case is in writing custom functions for h1 - h6 elements. In this case, token class names are CustomH1Token to CustomH6Token.

Expected behavior is that it would attempt to invoke functions render_custom_h1_token to render_custom_h6_token

However, current behavior instead attempts to invoke the function render_custom_h_token(self, token) for all six classes.