icyleaf / markd

Yet another markdown parser, Compliant to CommonMark specification, written in Crystal.
MIT License
109 stars 30 forks source link

Suggestion: semantic fixes #30

Closed dscottboggs closed 4 years ago

dscottboggs commented 4 years ago

When reading the source-code of renderer.cr and html_renderer.cr I was confused by two things:

Again these are just a couple quick suggestions I thought of while figuring out how to implement a custom renderer, you can feel free to close this if you want to keep your version. I just don't like to suggest things without offering to help.

dscottboggs commented 4 years ago

I've also changed the private state of a few methods on HTMLRenderer to protected so I can use them in a custom HTML renderer.

straight-shoota commented 4 years ago

I've also changed the private state of a few methods on HTMLRenderer to protected so I can use them in a custom HTML renderer.

Why did you need this? A custom renderer would inherit from HTMLRenderer, so it can also use these private methods.

dscottboggs commented 4 years ago

I thought "private" meant "only to this implementation" whereas "protected" was "this and all subclasses". If that's not the case then I certainly withdraw my suggestion.

straight-shoota commented 4 years ago

Nope, that's not how it works: https://crystal-lang.org/reference/syntax_and_semantics/visibility.html

dscottboggs commented 4 years ago

Thanks, @straight-shoota. When I was changing lf I noticed that it might also be desirable to use literal instead of lit. If you disagree let me know and I'll change it back