{"action":"created","issue":{"url":"https://api.github.com/repos/atlassian/commonmark-java/issues/8","labels_url":"https://api.github.com/repos/atlassian/commonmark-java/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/atlassian/commonmark-java/issues/8/comments","events_url":"https://api.github.com/repos/atlassian/commonmark-java/issues/8/events","html_url":"https://github.com/atlassian/commonmark-java/issues/8","id":99524842,"number":8,"title":"AST visitor pattern?","user":{"login":"pcj","id":50580,"avatar_url":"https://avatars.githubusercontent.com/u/50580?v=3","gravatar_id":"","url":"https://api.github.com/users/pcj","html_url":"https://github.com/pcj","followers_url":"https://api.github.com/users/pcj/followers","following_url":"https://api.github.com/users/pcj/following{/other_user}","gists_url":"https://api.github.com/users/pcj/gists{/gist_id}","starred_url":"https://api.github.com/users/pcj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcj/subscriptions","organizations_url":"https://api.github.com/users/pcj/orgs","repos_url":"https://api.github.com/users/pcj/repos","events_url":"https://api.github.com/users/pcj/events{/privacy}","received_events_url":"https://api.github.com/users/pcj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-06T21:07:04Z","updated_at":"2015-08-08T19:35:44Z","closed_at":null,"body":"Great that you are implementing the commonmark spec in java.  \r\n\r\nI like the way pegdown implements the Visitor Pattern to be able to modify or interpret the AST once constructed.  Is there a similar or planned facility for commonmark-java?  For example, in pegdown:\r\n\r\n\r\n```java\r\nimport org.pegdown.PegDownProcessor;\r\nimport org.pegdown.Extensions;\r\nimport org.pegdown.ast.RootNode;\r\nimport org.pegdown.ast.Visitor;\r\n\r\n...\r\n\r\nint exts\r\n    = Extensions.DEFINITIONS\r\n    | Extensions.AUTOLINKS\r\n    | Extensions.HARDWRAPS\r\n    | Extensions.TABLES\r\n    | Extensions.STRIKETHROUGH\r\n    | Extensions.SUPPRESS_ALL_HTML\r\n    ;\r\n\r\nPegDownProcessor processor = new PegDownProcessor(exts);\r\nRootNode root = processor.parseMarkdown(s.toCharArray());\r\n\r\nMyVisitor visitor = new MyVisitor();\r\nroot.accept(visitor);\r\n\r\n...\r\n\r\nclass MyVisitor implements Visitor {\r\n\r\n    @Override\r\n    public void visit(org.pegdown.ast.Node node) {\r\n        log.debug(\"visit {}\", node);\r\n    }\r\n\r\n   ...\r\n}\r\n\r\n```\r\n\r\nThanks,\r\nPaul"},"comment":{"url":"https://api.github.com/repos/atlassian/commonmark-java/issues/comments/129040259","html_url":"https://github.com/atlassian/commonmark-java/issues/8#issuecomment-129040259","issue_url":"https://api.github.com/repos/atlassian/commonmark-java/issues/8","id":129040259,"user":{"login":"pcj","id":50580,"avatar_url":"https://avatars.githubusercontent.com/u/50580?v=3","gravatar_id":"","url":"https://api.github.com/users/pcj","html_url":"https://github.com/pcj","followers_url":"https://api.github.com/users/pcj/followers","following_url":"https://api.github.com/users/pcj/following{/other_user}","gists_url":"https://api.github.com/users/pcj/gists{/gist_id}","starred_url":"https://api.github.com/users/pcj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcj/subscriptions","organizations_url":"https://api.github.com/users/pcj/orgs","repos_url":"https://api.github.com/users/pcj/repos","events_url":"https://api.github.com/users/pcj/events{/privacy}","received_events_url":"https://api.github.com/users/pcj/received_events","type":"User","site_admin":false},"created_at":"2015-08-08T19:35:44Z","updated_at":"2015-08-08T19:35:44Z","body":"Yes that's it.  Looks pretty obvious from the source now.  Example in the README a good idea.\r\n\r\nThanks!"}}