{"action":"created","issue":{"url":"https://api.github.com/repos/thlorenz/doctoc/issues/107","repository_url":"https://api.github.com/repos/thlorenz/doctoc","labels_url":"https://api.github.com/repos/thlorenz/doctoc/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/thlorenz/doctoc/issues/107/comments","events_url":"https://api.github.com/repos/thlorenz/doctoc/issues/107/events","html_url":"https://github.com/thlorenz/doctoc/pull/107","id":157563717,"number":107,"title":"Use markdown + html parsers to detect codeblocks","user":{"login":"jez","id":5544532,"avatar_url":"https://avatars.githubusercontent.com/u/5544532?v=3","gravatar_id":"","url":"https://api.github.com/users/jez","html_url":"https://github.com/jez","followers_url":"https://api.github.com/users/jez/followers","following_url":"https://api.github.com/users/jez/following{/other_user}","gists_url":"https://api.github.com/users/jez/gists{/gist_id}","starred_url":"https://api.github.com/users/jez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jez/subscriptions","organizations_url":"https://api.github.com/users/jez/orgs","repos_url":"https://api.github.com/users/jez/repos","events_url":"https://api.github.com/users/jez/events{/privacy}","received_events_url":"https://api.github.com/users/jez/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"thlorenz","id":192891,"avatar_url":"https://avatars.githubusercontent.com/u/192891?v=3","gravatar_id":"","url":"https://api.github.com/users/thlorenz","html_url":"https://github.com/thlorenz","followers_url":"https://api.github.com/users/thlorenz/followers","following_url":"https://api.github.com/users/thlorenz/following{/other_user}","gists_url":"https://api.github.com/users/thlorenz/gists{/gist_id}","starred_url":"https://api.github.com/users/thlorenz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thlorenz/subscriptions","organizations_url":"https://api.github.com/users/thlorenz/orgs","repos_url":"https://api.github.com/users/thlorenz/repos","events_url":"https://api.github.com/users/thlorenz/events{/privacy}","received_events_url":"https://api.github.com/users/thlorenz/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2016-05-30T22:44:34Z","updated_at":"2016-06-01T17:32:59Z","closed_at":"2016-06-01T16:57:30Z","pull_request":{"url":"https://api.github.com/repos/thlorenz/doctoc/pulls/107","html_url":"https://github.com/thlorenz/doctoc/pull/107","diff_url":"https://github.com/thlorenz/doctoc/pull/107.diff","patch_url":"https://github.com/thlorenz/doctoc/pull/107.patch"},"body":"**Relevant Issues**\r\n\r\nFixes #37, #38, #84, #88, #99.\r\n\r\n**Summary of Changes**\r\n\r\nThis commit builds upon the markdown-to-ast integration we added in #91,\r\nusing markdown-to-ast in `lib/get-html-headers.js`.\r\n\r\nWe first filter our lines to only look for HTML sections (using the\r\nmarkdown parser), then in these HTML-only sections, we search for headers,\r\nas long as they're not inside pre tags.\r\n\r\nThis is accomplished by keeping a stack of tags we've descended through. We\r\ncan peek at the top of the stack to see if we're directly under a\r\n`pre` tag, meaning we should ignore everything until we see the closing\r\n`pre`. Otherwise, we can collect text from inside heading tags as normal.\r\n\r\nThus, the core changes in this commit are:\r\n\r\n- `grabbing` is a stack now, instead of a string\r\n- `markdown-to-ast` lets us filter for only HTML blocks\r\n- `htmlparser2` lets us check if we're inside a heading *or* pre tag\r\n\r\n**Test Plan**\r\n\r\nThis pull request adds two passing tests:\r\n\r\n- one that makes sure we eliminate bad headings nested in pre tags, and\r\n- one that would fail a non-robust, regex-based search for code blocks,\r\n  excluding headings that should have been included\r\n\r\nBasically, the first checks for false positives, and the second checks\r\nfor false negatives."},"comment":{"url":"https://api.github.com/repos/thlorenz/doctoc/issues/comments/223067014","html_url":"https://github.com/thlorenz/doctoc/pull/107#issuecomment-223067014","issue_url":"https://api.github.com/repos/thlorenz/doctoc/issues/107","id":223067014,"user":{"login":"thlorenz","id":192891,"avatar_url":"https://avatars.githubusercontent.com/u/192891?v=3","gravatar_id":"","url":"https://api.github.com/users/thlorenz","html_url":"https://github.com/thlorenz","followers_url":"https://api.github.com/users/thlorenz/followers","following_url":"https://api.github.com/users/thlorenz/following{/other_user}","gists_url":"https://api.github.com/users/thlorenz/gists{/gist_id}","starred_url":"https://api.github.com/users/thlorenz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thlorenz/subscriptions","organizations_url":"https://api.github.com/users/thlorenz/orgs","repos_url":"https://api.github.com/users/thlorenz/repos","events_url":"https://api.github.com/users/thlorenz/events{/privacy}","received_events_url":"https://api.github.com/users/thlorenz/received_events","type":"User","site_admin":false},"created_at":"2016-06-01T17:32:59Z","updated_at":"2016-06-01T17:32:59Z","body":"Thanks published as minor upgrade (since some behavior may have changed)."}}
{"actor":{"display_login":"thlorenz"}}