Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getters for docParser/HtmlRenderer/extensions #46

Closed
wants to merge 2 commits into from

Conversation

dshafik
Copy link
Contributor

@dshafik dshafik commented Dec 31, 2014

These small additions make it much easier to make changes to the parser/renderer/environment (and helps to be able to effectively unit test them a bit better)

Added: made all private elements protected instead, kept running into issues when extending. A concrete example is that I am unable to easily add support for ?[Word](definition) as most of League\CommonMark\Inline\Parser\CloseBracketParser is private.

public function getHtmlRenderer()
{
return $this->htmlRenderer;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm against this change, simply because CommonMarkConverter is a stupid-simple convenience wrapper for people who only care about simple conversions of CommonMark.

Anyone needing additional functionality can easily init those classes themselves and do whatever they feel like.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why make it more difficult? Also, makes it easier when you think about extensions and the possibility of a factory.

Why should I have to create an environment, docParser and htmlRenderer, when all I want is to change one thing in the htmlRenderer? Instead use this and ->getHtmlRenderer() and go from there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when all I want is to change one thing in the htmlRenderer

There's nothing you can really change though - if there was, then I'd be okay with this change.

@colinodell
Copy link
Member

I'm closing this in favor of #52 and #53:

Thanks!

@colinodell colinodell closed this Jan 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants