{"action":"created","issue":{"url":"https://api.github.com/repos/jgm/cmark/issues/123","repository_url":"https://api.github.com/repos/jgm/cmark","labels_url":"https://api.github.com/repos/jgm/cmark/issues/123/labels{/name}","comments_url":"https://api.github.com/repos/jgm/cmark/issues/123/comments","events_url":"https://api.github.com/repos/jgm/cmark/issues/123/events","html_url":"https://github.com/jgm/cmark/pull/123","id":151014737,"number":123,"title":"Implement parsing extensions","user":{"login":"MathieuDuponchelle","id":1278273,"avatar_url":"https://avatars.githubusercontent.com/u/1278273?v=3","gravatar_id":"","url":"https://api.github.com/users/MathieuDuponchelle","html_url":"https://github.com/MathieuDuponchelle","followers_url":"https://api.github.com/users/MathieuDuponchelle/followers","following_url":"https://api.github.com/users/MathieuDuponchelle/following{/other_user}","gists_url":"https://api.github.com/users/MathieuDuponchelle/gists{/gist_id}","starred_url":"https://api.github.com/users/MathieuDuponchelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MathieuDuponchelle/subscriptions","organizations_url":"https://api.github.com/users/MathieuDuponchelle/orgs","repos_url":"https://api.github.com/users/MathieuDuponchelle/repos","events_url":"https://api.github.com/users/MathieuDuponchelle/events{/privacy}","received_events_url":"https://api.github.com/users/MathieuDuponchelle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2016-04-26T00:46:31Z","updated_at":"2016-05-07T01:23:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jgm/cmark/pulls/123","html_url":"https://github.com/jgm/cmark/pull/123","diff_url":"https://github.com/jgm/cmark/pull/123.diff","patch_url":"https://github.com/jgm/cmark/pull/123.patch"},"body":"Reference discussion: https://github.com/jgm/cmark/issues/100\r\n\r\nI just rebased the branch on master and tested it, make passes with no new warnings all along the branch, valgrinding a table test shows no leaks.\r\n\r\nI applied the initial review comments from @jgm and @nwellnhof , which were to not expose cmark_strbuf, which is thus included in the sources of the reference \"core extension\", and to not expose API using cmark's bool type, which is replaced by integers, rendering installation of config.h unnecessary.\r\n\r\nThe design implemented is the second one I proposed in the above discussion, here's a brief summary:\r\n\r\n* A new structure is exposed, `cmark_syntax_extension`, which exposes hooks that match the block and inline parsing strategies outlined in <http://spec.commonmark.org/0.25/#appendix-a-parsing-strategy> .\r\n\r\n* This proposal does not cover the implementation of new block types, instead syntax extensions need to create blocks with types defined by cmark itself, including `CMARK_NODE_CUSTOM_BLOCK` and `CMARK_NODE_CUSTOM_INLINE`, this already covers a wide range of use cases.\r\n\r\n  That is because in my opinion, we want cmark to guarantee that the output AST will always be correctly structured (with the exception of custom inlines and blocks), with no \"impossible\" or \"maningless\" block nesting situations.\r\n\r\n  An interesting enhancement would be to refactor the custom inline and block types to let extensions provide virtual methods such as \"can_contain\" for them, but this will be somehow fragile as \"inter-extension negotiation\" will not be possible.\r\n\r\n* An important part of this proposal is that cmark implement and expose block types for which it does not yet have a formal syntax specification, such as tables or strikethroughs. I believe this is desirable because this will allow multiple syntax extensions to compete for a given desired output, without tying cmark's specification to a specific syntax, while still making sure the produced output is correct. It makes sense when looking at it as a testing ground if you will.\r\n\r\nIt is important to state that this design doesn't prevent us from implementing negotiation in the future if we so desire.\r\n\r\nI think this branch is now approaching what I'd consider mergeable quality, with the exception of the plugin code, which I think is mostly correct on Linux, but will not work on Windows. If @nwellnhof is interested in tackling the abstraction for Windows, then all the best, otherwise the code can be merged without plugin loading / discovery for now, as it is already useful for people using cmark as a library (such as I).\r\n\r\nLast thing, this last rebase round has been pretty involved, and I'd very much like (if we all agree that extensions are desirable) that merging this branch be made a priority, I will of course address reviews in a timely manner."},"comment":{"url":"https://api.github.com/repos/jgm/cmark/issues/comments/217596565","html_url":"https://github.com/jgm/cmark/pull/123#issuecomment-217596565","issue_url":"https://api.github.com/repos/jgm/cmark/issues/123","id":217596565,"user":{"login":"MathieuDuponchelle","id":1278273,"avatar_url":"https://avatars.githubusercontent.com/u/1278273?v=3","gravatar_id":"","url":"https://api.github.com/users/MathieuDuponchelle","html_url":"https://github.com/MathieuDuponchelle","followers_url":"https://api.github.com/users/MathieuDuponchelle/followers","following_url":"https://api.github.com/users/MathieuDuponchelle/following{/other_user}","gists_url":"https://api.github.com/users/MathieuDuponchelle/gists{/gist_id}","starred_url":"https://api.github.com/users/MathieuDuponchelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MathieuDuponchelle/subscriptions","organizations_url":"https://api.github.com/users/MathieuDuponchelle/orgs","repos_url":"https://api.github.com/users/MathieuDuponchelle/repos","events_url":"https://api.github.com/users/MathieuDuponchelle/events{/privacy}","received_events_url":"https://api.github.com/users/MathieuDuponchelle/received_events","type":"User","site_admin":false},"created_at":"2016-05-07T01:23:56Z","updated_at":"2016-05-07T01:23:56Z","body":"I'll be in holidays for the next two weeks, going to <https://wiki.gnome.org/Hackfests/GstSpringHackfest2016> , I'll check on that issue from time to time but I can't promise immediate reactivity :)"}}