miyuchina/mistletoe

Use strict PascalCase for class names

Closed this issue · 3 comments

The historically used "lenient" usage of the PascalCase (pascal case) convention in mistletoe is quite impractical when it comes to introducing more complex names. I suggest here to use the strict variant which doesn't have this problem and leads to a more consistent code base.

E.g. change HTMLRenderer to HtmlRenderer, HTMLBlock to HtmlBlock.

For backwards compatibility, we can introduce aliases for the old names, marking them as deprecated.

Not impressed by this change. PEP-8 says:

Note: When using acronyms in CapWords, capitalize all the letters of the acronym. Thus HTTPServerError is better than HttpServerError.

Meanwhile, this is a hard-breaking change for anyone who uses mistletoe.HTMLRenderer rather than mistletoe.html_renderer.HTMLRenderer.

@pydsigner, thanks for letting us know and sorry for the inconvenience! I have just released v1.2.1 where mistletoe.HTMLRenderer should work again.

Regarding the change to "strict PascalCase" itself, you are right that PEP-8 suggests the other way. AFAIK in C-style languages (which Python isn't, I know ;)), HtmlRenderer is the recommended way to go (see e.g. here), even if there is just one acronym in the name. But I'm not strictly against returning to the PEP-8 style, provided it will be requested by the mistletoe community...