{"action":"created","issue":{"url":"https://api.github.com/repos/markdown-it/markdown-it/issues/457","repository_url":"https://api.github.com/repos/markdown-it/markdown-it","labels_url":"https://api.github.com/repos/markdown-it/markdown-it/issues/457/labels{/name}","comments_url":"https://api.github.com/repos/markdown-it/markdown-it/issues/457/comments","events_url":"https://api.github.com/repos/markdown-it/markdown-it/issues/457/events","html_url":"https://github.com/markdown-it/markdown-it/issues/457","id":320401427,"number":457,"title":"Custom highlight function cannot access the attributes of the fence token","user":{"login":"simondean","id":190464,"avatar_url":"https://avatars0.githubusercontent.com/u/190464?v=4","gravatar_id":"","url":"https://api.github.com/users/simondean","html_url":"https://github.com/simondean","followers_url":"https://api.github.com/users/simondean/followers","following_url":"https://api.github.com/users/simondean/following{/other_user}","gists_url":"https://api.github.com/users/simondean/gists{/gist_id}","starred_url":"https://api.github.com/users/simondean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simondean/subscriptions","organizations_url":"https://api.github.com/users/simondean/orgs","repos_url":"https://api.github.com/users/simondean/repos","events_url":"https://api.github.com/users/simondean/events{/privacy}","received_events_url":"https://api.github.com/users/simondean/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-04T19:36:01Z","updated_at":"2018-05-16T22:33:10Z","closed_at":"2018-05-16T22:33:10Z","author_association":"NONE","body":"A custom `highlight` function cannot access the attributes of the fence token.  The built-in [`fence` function](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js#L39) can access the attributes of the token with the following code but a custom `highlight` function has no way to do this.  \r\n\r\n```javascript\r\nvar token = tokens[idx]\r\n...\r\ntmpAttrs = token.attrs ? token.attrs.slice() : [];\r\n```\r\n\r\nThis means that any custom attributes added to the current token by extensions (e.g. a custom class name added by an extension) are available to the `fence` function but not available to a custom `highlight` function.  "},"comment":{"url":"https://api.github.com/repos/markdown-it/markdown-it/issues/comments/389686870","html_url":"https://github.com/markdown-it/markdown-it/issues/457#issuecomment-389686870","issue_url":"https://api.github.com/repos/markdown-it/markdown-it/issues/457","id":389686870,"user":{"login":"puzrin","id":319465,"avatar_url":"https://avatars2.githubusercontent.com/u/319465?v=4","gravatar_id":"","url":"https://api.github.com/users/puzrin","html_url":"https://github.com/puzrin","followers_url":"https://api.github.com/users/puzrin/followers","following_url":"https://api.github.com/users/puzrin/following{/other_user}","gists_url":"https://api.github.com/users/puzrin/gists{/gist_id}","starred_url":"https://api.github.com/users/puzrin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puzrin/subscriptions","organizations_url":"https://api.github.com/users/puzrin/orgs","repos_url":"https://api.github.com/users/puzrin/repos","events_url":"https://api.github.com/users/puzrin/events{/privacy}","received_events_url":"https://api.github.com/users/puzrin/received_events","type":"User","site_admin":false},"created_at":"2018-05-16T22:33:10Z","updated_at":"2018-05-16T22:33:10Z","author_association":"MEMBER","body":"Thanks. `markdown-it-attrs` syntax is not stable (not approved in spec yet) and i'd like to avoid API change \"in advance\". IMHO if you use specific hacks for highlighter, it would be more logical to hack fenced renderer too and keep things in one place (at your side)."}}
{"actor":{"display_login":"puzrin"}}