5 ms·
PHP CommonMark
- erusev 12y agoParsedown has also been moving towards compliance with CommonMark. http://parsedown.org/ http://parsedown.org/
- fredleblanc 12y agoHooray, parsedown! Thank you for your hard work on this, it's my favorite of the PHP markdown parsers. I really like the philosophy and execution.
- aleem 12y agoI haven't used Parsedown but I am glad things are moving to CommonMark -- it will shift the focus to performance, structure and extensibility instead of struggling with edge cases and Markdown idiosyncrasies. PHP CommonMark's compliance is very current--CommonMark spec 0.13, Dec 15, 2014 and it will continue to keep up. It follows the reference implementation very closely, has good support for extensibility and the code is very well structured. It's likely to become the de facto PHP implementation in my opinion.
- boksiora 12y agoI like Parsedown its very fast!
- laacz 12y agoIs there a need for that much of abstraction in a simple markdown parser library?
- donatj 12y agoIt does feel like a bit much.
- pan69 12y agoWhat abstraction are you specifically referring to if I my ask?
- nacs 12y agoI think parent post is just referring to the number of classes in the source.
- deleted 12y ago[deleted]
- alexbilbie 12y agoBy abstracting to the extent that the author has it should be simple to add other syntaxes to the library (e.g. rST -> HTML)
- laacz 12y agoYes, but project is called CommonMark, so it's markdown only.
- alexbilbie 12y agoI appreciate that, we argued to death on the League internals about the focus of the package: https://groups.google.com/forum/#!topic/thephpleague/cJECuC5TsGQ https://groups.google.com/forum/#!topic/thephpleague/cJECuC5... https://groups.google.com/forum/#!topic/thephpleague/YBSnpS6dra8 https://groups.google.com/forum/#!topic/thephpleague/YBSnpS6...
- philstu 12y agorST > HTML is less likely, but CommonMark > PDF could definitely be a thing.
- philstu 12y agoIt depends which bit you're talking about. A lot of implementations in various languages go with static regex approaches, which is a bit shit. This uses an AST which helps out a lot. By adding the customization elements, people can write "GitHub Tables" or any sort of other extra syntax in. And by keeping the HTML Rendering separate from the parsing process, other PDF renderers or whatever else could be added. Somebody could make a [Maruka](http://markua.org/ http://markua.org/) extension for example, which is just CommonMark + Extra tags + PDF / eBook / etc. It's not madness, and it will be optimized over time. Fear not. :)
- _RPM 12y agohttps://github.com/thephpleague/commonmark/blob/master/src/Util/ArrayCollection.php#L112 https://github.com/thephpleague/commonmark/blob/master/src/U... What is the Point of abstracting away "empty?"
- alexbilbie 12y agoI guess because you're asking a question of the object - "is this empty?"
- deleted 12y ago[deleted]
- Rygu 12y agoIt already implements count() and the corresponding interface so it's possible to write count($collection) as if you're writing $collection->count(). It's a valid question why this type of object needs two methods for checking the same property.
- hrtyl 12y agoPHP does not have an interface for empty. count and empty are not equivalent. empty should be called on the underlying array and not the object.
- aercolino 12y agoSorry to add a critic. If you want to make your PHP classes easy to extend, refrain from private and prefer protected. Otherwise, a developer that wants to extend one of your classes will need to also override (i.e. copy and paste) into her class all private members called from the members she really wants to override.
- jrochkind1 12y agoAha! The controversial "Standard Markdown" (is that what it used to be called?) has been renamed to "CommonMark", hopefully avoiding the controversy. (Controversial because Gruber didn't like them using the Markdown name in a standardization effort). I'm glad. I hope to see implementations continue to spread.
- philstu 12y agoHere's a whole update on the general state of markdown https://philsturgeon.uk/markdown/2014/11/30/state-of-markdown/ https://philsturgeon.uk/markdown/2014/11/30/state-of-markdow...