{"action":"created","issue":{"url":"https://api.github.com/repos/jgm/pandoc/issues/3209","repository_url":"https://api.github.com/repos/jgm/pandoc","labels_url":"https://api.github.com/repos/jgm/pandoc/issues/3209/labels{/name}","comments_url":"https://api.github.com/repos/jgm/pandoc/issues/3209/comments","events_url":"https://api.github.com/repos/jgm/pandoc/issues/3209/events","html_url":"https://github.com/jgm/pandoc/issues/3209","id":187023949,"number":3209,"title":"Link reference labels fail when beginning with `@`","user":{"login":"kgryte","id":2643044,"avatar_url":"https://avatars.githubusercontent.com/u/2643044?v=3","gravatar_id":"","url":"https://api.github.com/users/kgryte","html_url":"https://github.com/kgryte","followers_url":"https://api.github.com/users/kgryte/followers","following_url":"https://api.github.com/users/kgryte/following{/other_user}","gists_url":"https://api.github.com/users/kgryte/gists{/gist_id}","starred_url":"https://api.github.com/users/kgryte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgryte/subscriptions","organizations_url":"https://api.github.com/users/kgryte/orgs","repos_url":"https://api.github.com/users/kgryte/repos","events_url":"https://api.github.com/users/kgryte/events{/privacy}","received_events_url":"https://api.github.com/users/kgryte/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-11-03T10:35:20Z","updated_at":"2016-11-07T05:57:29Z","closed_at":"2016-11-05T20:19:52Z","body":"Tested in `pandoc` versions: `1.11` and `1.18` (latest).\r\n\r\n## Command\r\n\r\n``` bash\r\n$ pandoc --from=markdown_github-citations --to=html5 <file.md>\r\n```\r\n\r\nwhere `<file.md>` has contents\r\n\r\n```\r\ndoi:[10.1007/BF02293108][@ahrens:1974]\r\n\r\n[@ahrens:1974]: http://dx.doi.org/10.1007/BF02293108\r\n```\r\n\r\n## Output\r\n\r\n`pandoc` generates the following output\r\n\r\n``` html\r\n<a href=\"doi:%5B10.1007/BF02293108%5D%5B@ahrens:1974%5D\" class=\"uri\">doi:[10.1007/BF02293108][@ahrens:1974]</a>\r\n```\r\n\r\n## Expected Output\r\n\r\nThe expected output should match GitHub and the commonmark spec (see [demo](http://spec.commonmark.org/dingus/?text=doi%3A%5B10.1007%2FBF02293108%5D%5B%40ahrens%3A1974%5D%0A%0A%5B%40ahrens%3A1974%5D%3A%20http%3A%2F%2Fdx.doi.org%2F10.1007%2FBF02293108)).\r\n\r\n``` html\r\ndoi:<a href=\"http://dx.doi.org/10.1007/BF02293108\">10.1007/BF02293108</a>\r\n```\r\n\r\n## Debugging\r\n\r\nIf I insert a space as follows `doi: [10.1007/BF02293108][@ahrens:1974]`, `pandoc` still does not return the expected output.\r\n\r\n``` html\r\ndoi: [10.1007/BF02293108]<a href=\"http://dx.doi.org/10.1007/BF02293108\">@ahrens:1974</a>\r\n```\r\n\r\nIf I remove the `@` symbol to check whether `pandoc` is confused by a possible citation,\r\n\r\n```\r\ndoi:[10.1007/BF02293108][ahrens:1974]\r\n\r\n[ahrens:1974]: http://dx.doi.org/10.1007/BF02293108\r\n```\r\n\r\n`pandoc` returns similar results\r\n\r\n``` html\r\n<a href=\"doi:%5B10.1007/BF02293108%5D%5Bahrens:1974%5D\" class=\"uri\">doi:[10.1007/BF02293108][ahrens:1974]</a>\r\n```\r\n\r\nDisabling `autolink_bare_uris`\r\n\r\n``` bash\r\n$ pandoc --from=markdown_github-citations-autolink_bare_uris --to=html5 <file.md>\r\n```\r\ngives the following results\r\n\r\n``` html\r\ndoi:[10.1007/BF02293108]<a href=\"http://dx.doi.org/10.1007/BF02293108\">@ahrens:1974</a>\r\n```\r\n\r\nFinally, replacing the colon with a space `doi [10.1007/BF02293108][@ahrens:1974]` yields the following\r\n\r\n``` html\r\ndoi [10.1007/BF02293108]<a href=\"http://dx.doi.org/10.1007/BF02293108\">@ahrens:1974</a>\r\n```\r\n\r\n## Background\r\n\r\nThe Markdown file in question contains a citation reference generated by `pandoc`\r\n\r\n```\r\nAhrens, J.H., and U. Dieter. 1974. \"Computer methods for sampling from gamma, beta, poisson and bionomial distributions.\" *Computing* 12 (3): 223–46. doi:[10.1007/BF02293108](https://doi.org/10.1007/BF02293108).\r\n```\r\nwith the modification that, instead of an inline link, a reference link is used.\r\n\r\n```\r\nAhrens, J.H., and U. Dieter. 1974. \"Computer methods for sampling from gamma, beta, poisson and bionomial distributions.\" *Computing* 12 (3): 223–46. doi:[10.1007/BF02293108][@ahrens:1974].\r\n\r\n[@ahrens:1974]: https://doi.org/10.1007/BF02293108\r\n```"},"comment":{"url":"https://api.github.com/repos/jgm/pandoc/issues/comments/258753472","html_url":"https://github.com/jgm/pandoc/issues/3209#issuecomment-258753472","issue_url":"https://api.github.com/repos/jgm/pandoc/issues/3209","id":258753472,"user":{"login":"kgryte","id":2643044,"avatar_url":"https://avatars.githubusercontent.com/u/2643044?v=3","gravatar_id":"","url":"https://api.github.com/users/kgryte","html_url":"https://github.com/kgryte","followers_url":"https://api.github.com/users/kgryte/followers","following_url":"https://api.github.com/users/kgryte/following{/other_user}","gists_url":"https://api.github.com/users/kgryte/gists{/gist_id}","starred_url":"https://api.github.com/users/kgryte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgryte/subscriptions","organizations_url":"https://api.github.com/users/kgryte/orgs","repos_url":"https://api.github.com/users/kgryte/repos","events_url":"https://api.github.com/users/kgryte/events{/privacy}","received_events_url":"https://api.github.com/users/kgryte/received_events","type":"User","site_admin":false},"created_at":"2016-11-07T05:57:29Z","updated_at":"2016-11-07T05:57:29Z","body":"@jgm Thanks!"}}
{"actor":{"display_login":"kgryte"}}