{"action":"created","issue":{"url":"https://api.github.com/repos/spatialaudio/nbsphinx/issues/18","repository_url":"https://api.github.com/repos/spatialaudio/nbsphinx","labels_url":"https://api.github.com/repos/spatialaudio/nbsphinx/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/spatialaudio/nbsphinx/issues/18/comments","events_url":"https://api.github.com/repos/spatialaudio/nbsphinx/issues/18/events","html_url":"https://github.com/spatialaudio/nbsphinx/pull/18","id":130262014,"number":18,"title":"hack to handle pdf figures in notebook","user":{"login":"aebrahim","id":1380168,"avatar_url":"https://avatars.githubusercontent.com/u/1380168?v=3","gravatar_id":"","url":"https://api.github.com/users/aebrahim","html_url":"https://github.com/aebrahim","followers_url":"https://api.github.com/users/aebrahim/followers","following_url":"https://api.github.com/users/aebrahim/following{/other_user}","gists_url":"https://api.github.com/users/aebrahim/gists{/gist_id}","starred_url":"https://api.github.com/users/aebrahim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aebrahim/subscriptions","organizations_url":"https://api.github.com/users/aebrahim/orgs","repos_url":"https://api.github.com/users/aebrahim/repos","events_url":"https://api.github.com/users/aebrahim/events{/privacy}","received_events_url":"https://api.github.com/users/aebrahim/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-02-01T05:40:42Z","updated_at":"2016-02-23T09:16:40Z","closed_at":"2016-02-04T08:20:23Z","pull_request":{"url":"https://api.github.com/repos/spatialaudio/nbsphinx/pulls/18","html_url":"https://github.com/spatialaudio/nbsphinx/pull/18","diff_url":"https://github.com/spatialaudio/nbsphinx/pull/18.diff","patch_url":"https://github.com/spatialaudio/nbsphinx/pull/18.patch"},"body":"This may not be the correct way to handle it, but it was the easiest way to fix this bug:\r\n\r\nIn some of my notebooks, I use this code block, which causes issues:\r\n\r\n```python\r\nfrom IPython.display import set_matplotlib_formats\r\nset_matplotlib_formats('png', 'pdf')\r\n```\r\n\r\nSpecifically, it causes the notebook output to look like this:\r\n```json\r\n\"outputs\": [\r\n    {\r\n     \"data\": {\r\n      \"application/pdf\": \"JVBERi0xLjQKJazcIKu6CjEgMCBvYmoKPD<etc>==\\n\",\r\n      \"image/png\": \"iVBORw0KGgoAAAANSUhEUgAAAV0AAADtCAYAAAAc<etc>=\\n\",\r\n      \"text/plain\": [\r\n       \"<matplotlib.figure.Figure at 0x7f7c2c22f3d0>\"\r\n      ]\r\n     },\r\n     \"metadata\": {},\r\n     \"output_type\": \"display_data\"\r\n    }\r\n   ],\r\n```\r\n\r\nWhen I run this with sphinx, I get the following in my built html file:\r\n![image](https://cloud.githubusercontent.com/assets/1380168/12709549/1a08b390-c862-11e5-8d32-1dcd4214f20e.png)\r\n\r\nThis basically just changes the template so instead of having an extension on the written filename of the image, it leaves it with an asterix (i.e. my_image.* instead of my_image.png). This lets sphinx choose the appropriate image based on the backend ([sphinx docs link](http://www.sphinx-doc.org/en/stable/rest.html#images))\r\n\r\nThis assumes the extension is 3 characters, which I thought was probably a fairly good assumption (png, pdf, jpg, svg), but maybe there will be exceptions I haven't thought of."},"comment":{"url":"https://api.github.com/repos/spatialaudio/nbsphinx/issues/comments/187613475","html_url":"https://github.com/spatialaudio/nbsphinx/pull/18#issuecomment-187613475","issue_url":"https://api.github.com/repos/spatialaudio/nbsphinx/issues/18","id":187613475,"user":{"login":"mgeier","id":705404,"avatar_url":"https://avatars.githubusercontent.com/u/705404?v=3","gravatar_id":"","url":"https://api.github.com/users/mgeier","html_url":"https://github.com/mgeier","followers_url":"https://api.github.com/users/mgeier/followers","following_url":"https://api.github.com/users/mgeier/following{/other_user}","gists_url":"https://api.github.com/users/mgeier/gists{/gist_id}","starred_url":"https://api.github.com/users/mgeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgeier/subscriptions","organizations_url":"https://api.github.com/users/mgeier/orgs","repos_url":"https://api.github.com/users/mgeier/repos","events_url":"https://api.github.com/users/mgeier/events{/privacy}","received_events_url":"https://api.github.com/users/mgeier/received_events","type":"User","site_admin":false},"created_at":"2016-02-23T09:16:40Z","updated_at":"2016-02-23T09:16:40Z","body":"I've created a separate issue for that (#25), feel free to submit a PR!"}}