{"action":"created","issue":{"url":"https://api.github.com/repos/Rosey/markdown-draft-js/issues/49","repository_url":"https://api.github.com/repos/Rosey/markdown-draft-js","labels_url":"https://api.github.com/repos/Rosey/markdown-draft-js/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/Rosey/markdown-draft-js/issues/49/comments","events_url":"https://api.github.com/repos/Rosey/markdown-draft-js/issues/49/events","html_url":"https://github.com/Rosey/markdown-draft-js/pull/49","id":294550786,"number":49,"title":"Add support for images","user":{"login":"tlackemann","id":2633753,"avatar_url":"https://avatars2.githubusercontent.com/u/2633753?v=4","gravatar_id":"","url":"https://api.github.com/users/tlackemann","html_url":"https://github.com/tlackemann","followers_url":"https://api.github.com/users/tlackemann/followers","following_url":"https://api.github.com/users/tlackemann/following{/other_user}","gists_url":"https://api.github.com/users/tlackemann/gists{/gist_id}","starred_url":"https://api.github.com/users/tlackemann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlackemann/subscriptions","organizations_url":"https://api.github.com/users/tlackemann/orgs","repos_url":"https://api.github.com/users/tlackemann/repos","events_url":"https://api.github.com/users/tlackemann/events{/privacy}","received_events_url":"https://api.github.com/users/tlackemann/received_events","type":"User","site_admin":false},"labels":[{"id":462670342,"url":"https://api.github.com/repos/Rosey/markdown-draft-js/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-02-05T21:36:47Z","updated_at":"2018-03-01T18:20:21Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/Rosey/markdown-draft-js/pulls/49","html_url":"https://github.com/Rosey/markdown-draft-js/pull/49","diff_url":"https://github.com/Rosey/markdown-draft-js/pull/49.diff","patch_url":"https://github.com/Rosey/markdown-draft-js/pull/49.patch"},"body":"Hey,\r\n\r\nThank you sincerely for this wonderfully written package. No rush in merging or reviewing but I wanted to extend the functionality to allow the translation of images from markdown -> draft and from draft -> markdown.\r\n\r\n## Todo\r\n\r\n - [ ] Support alt/title statements"},"comment":{"url":"https://api.github.com/repos/Rosey/markdown-draft-js/issues/comments/369682808","html_url":"https://github.com/Rosey/markdown-draft-js/pull/49#issuecomment-369682808","issue_url":"https://api.github.com/repos/Rosey/markdown-draft-js/issues/49","id":369682808,"user":{"login":"Rosey","id":1326431,"avatar_url":"https://avatars0.githubusercontent.com/u/1326431?v=4","gravatar_id":"","url":"https://api.github.com/users/Rosey","html_url":"https://github.com/Rosey","followers_url":"https://api.github.com/users/Rosey/followers","following_url":"https://api.github.com/users/Rosey/following{/other_user}","gists_url":"https://api.github.com/users/Rosey/gists{/gist_id}","starred_url":"https://api.github.com/users/Rosey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rosey/subscriptions","organizations_url":"https://api.github.com/users/Rosey/orgs","repos_url":"https://api.github.com/users/Rosey/repos","events_url":"https://api.github.com/users/Rosey/events{/privacy}","received_events_url":"https://api.github.com/users/Rosey/received_events","type":"User","site_admin":false},"created_at":"2018-03-01T18:20:21Z","updated_at":"2018-03-01T18:20:21Z","author_association":"OWNER","body":"@nicholaswbowen while you're waiting on this, it should be possible to easily steal this code and use it as a plugin - plugins are documented in the README, but it should be something like this (warning: untested example code, so I may have messed up with a typo or silly mistake!) -\r\n\r\nDraft to markdown -\r\n\r\n```javascript\r\ndraftToMarkdown(rawDraftJsObject, \r\n  entityItems: {\r\n    image: {\r\n      open: function (entity) {\r\n        return '';\r\n    },\r\n\r\n      close: function (entity) {\r\n        return `![](${entity.data.src})`;\r\n      }\r\n  }\r\n)\r\n```\r\n\r\nMarkdown to draft -\r\n\r\n```javascript\r\nmarkdownToDraft(markdownString, \r\n  blockEntities: {\r\n    image: function (item) {\r\n      return {\r\n        type: 'atomic',\r\n        mutability: 'IMMUTABLE',\r\n        data: {\r\n          src: item.src,\r\n        },\r\n      }\r\n  }\r\n)\r\n```"}}
{"actor":{"display_login":"Rosey"}}