{"action":"created","issue":{"url":"https://api.github.com/repos/ocaml/omd/issues/174","repository_url":"https://api.github.com/repos/ocaml/omd","labels_url":"https://api.github.com/repos/ocaml/omd/issues/174/labels{/name}","comments_url":"https://api.github.com/repos/ocaml/omd/issues/174/comments","events_url":"https://api.github.com/repos/ocaml/omd/issues/174/events","html_url":"https://github.com/ocaml/omd/pull/174","id":379760322,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwMTIxOTg3","number":174,"title":"Refactor library, add CommonMark compatibility","user":{"login":"nojb","id":113560,"node_id":"MDQ6VXNlcjExMzU2MA==","avatar_url":"https://avatars3.githubusercontent.com/u/113560?v=4","gravatar_id":"","url":"https://api.github.com/users/nojb","html_url":"https://github.com/nojb","followers_url":"https://api.github.com/users/nojb/followers","following_url":"https://api.github.com/users/nojb/following{/other_user}","gists_url":"https://api.github.com/users/nojb/gists{/gist_id}","starred_url":"https://api.github.com/users/nojb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nojb/subscriptions","organizations_url":"https://api.github.com/users/nojb/orgs","repos_url":"https://api.github.com/users/nojb/repos","events_url":"https://api.github.com/users/nojb/events{/privacy}","received_events_url":"https://api.github.com/users/nojb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-11-12T12:44:00Z","updated_at":"2018-11-12T19:52:05Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/ocaml/omd/pulls/174","html_url":"https://github.com/ocaml/omd/pull/174","diff_url":"https://github.com/ocaml/omd/pull/174.diff","patch_url":"https://github.com/ocaml/omd/pull/174.patch"},"body":"(**not yet for merge**, see below)\r\n\r\nThis PR is the second part of #167. I had two objectives when I started working on this library:\r\n\r\n- Make the library hackeable\r\n- be [CommonMark](https://spec.commonmark.org/)-compartible\r\n\r\nThe current PR mostly attains these two objectives. Unfortunately, along the way, virtually the whole library had to be rewritten, so almost none of the original code is left. This was not my initial intention, but it was the result of incremental changes.\r\n\r\nThere are two main changes in this PR:\r\n\r\n- A new representation for markdown documents:\r\n```ocaml\r\ntype 'a link_def =\r\n  {\r\n    label: 'a;\r\n    destination: string;\r\n    title: string option;\r\n  }\r\n\r\ntype 'a block =\r\n  | Paragraph of 'a\r\n  | List of list_kind * list_style * 'a block list list\r\n  | Blockquote of 'a block list\r\n  | Thematic_break\r\n  | Heading of int * 'a\r\n  | Code_block of (fenced_code_kind * string) option * string option\r\n  | Html_block of string\r\n  | Link_def of string link_def\r\n\r\ntype link_kind =\r\n  | Img\r\n  | Url\r\n\r\ntype inline =\r\n  | Concat of inline list\r\n  | Text of string\r\n  | Emph of emph_kind * emph_style * inline\r\n  | Code of string\r\n  | Hard_break\r\n  | Soft_break\r\n  | Link of link_kind * inline link_def\r\n  | Ref of link_kind * inline * string link_def\r\n  | Html of string\r\n\r\ntype t = inline block\r\n```\r\nThis new representation can only represent \"legal\" markdown documents, which removes a whole category of bugs.\r\n- A new parsing algorithm, corresponding to the representation of markdown documents in two levels (blocks and inlines).\r\n  - First, the block structure is parsed with the inline contents taken as strings, and second, the inline content is parsed within each leaf block (this is the most complicated part of the code).\r\n  - The new parser does not lex the input data into tokens, it parses the strings directly at the level of characters.\r\n  - It would be easy to modify the parser for full Unicode support (right now, the input is considered to be a stream of bytes and that is enough for 99% of the cases, but anyway).\r\n\r\nAfter much iterative work, the library passes roughly 720 out of 735 tests. The remaining tests concern some tricky edge cases which I intend to fix before the merge or shortly after. Because of the iterative way I developed this library there is a fair amount of cleaning up and simplifications that I will be doing in the next few days. Once that is done, I think we should merge this PR.\r\n\r\nI will also in the next few days try to regenerate `ocaml.org` to start looking for regressions there. Any help would be appreciated (cc @Chris00)\r\n\r\nFixes #40, fixes #51, fixes #76, fixes #94, fixes #121, fixes #123, fixes #126, fixes #127, fixes #129, fixes #132, fixes #137, fixes #154"},"comment":{"url":"https://api.github.com/repos/ocaml/omd/issues/comments/438007642","html_url":"https://github.com/ocaml/omd/pull/174#issuecomment-438007642","issue_url":"https://api.github.com/repos/ocaml/omd/issues/174","id":438007642,"node_id":"MDEyOklzc3VlQ29tbWVudDQzODAwNzY0Mg==","user":{"login":"nojb","id":113560,"node_id":"MDQ6VXNlcjExMzU2MA==","avatar_url":"https://avatars3.githubusercontent.com/u/113560?v=4","gravatar_id":"","url":"https://api.github.com/users/nojb","html_url":"https://github.com/nojb","followers_url":"https://api.github.com/users/nojb/followers","following_url":"https://api.github.com/users/nojb/following{/other_user}","gists_url":"https://api.github.com/users/nojb/gists{/gist_id}","starred_url":"https://api.github.com/users/nojb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nojb/subscriptions","organizations_url":"https://api.github.com/users/nojb/orgs","repos_url":"https://api.github.com/users/nojb/repos","events_url":"https://api.github.com/users/nojb/events{/privacy}","received_events_url":"https://api.github.com/users/nojb/received_events","type":"User","site_admin":false},"created_at":"2018-11-12T19:52:05Z","updated_at":"2018-11-12T19:52:05Z","author_association":"COLLABORATOR","body":"> Option -otoc is used for ocaml.org and not supporting it will break the website pretty hard I think.\r\n\r\nI will add this back shortly.\r\n\r\n> Option -r is used as well, for highlighting code snippets.\r\n\r\nI don't remember what this is, but will add it back if necessary.\r\n\r\n> Do you support media:type=\"text/omd\" or did you remove that as well?\r\n\r\nCould you remind me what is this about?"}}
{"actor":{"display_login":"nojb"}}