{"action":"created","issue":{"url":"https://api.github.com/repos/ryneeverett/python-markdown-comments/issues/2","labels_url":"https://api.github.com/repos/ryneeverett/python-markdown-comments/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/ryneeverett/python-markdown-comments/issues/2/comments","events_url":"https://api.github.com/repos/ryneeverett/python-markdown-comments/issues/2/events","html_url":"https://github.com/ryneeverett/python-markdown-comments/issues/2","id":58835264,"number":2,"title":"Comments in code lines/blocks","user":{"login":"snoozbuster","id":5778364,"avatar_url":"https://avatars.githubusercontent.com/u/5778364?v=3","gravatar_id":"","url":"https://api.github.com/users/snoozbuster","html_url":"https://github.com/snoozbuster","followers_url":"https://api.github.com/users/snoozbuster/followers","following_url":"https://api.github.com/users/snoozbuster/following{/other_user}","gists_url":"https://api.github.com/users/snoozbuster/gists{/gist_id}","starred_url":"https://api.github.com/users/snoozbuster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snoozbuster/subscriptions","organizations_url":"https://api.github.com/users/snoozbuster/orgs","repos_url":"https://api.github.com/users/snoozbuster/repos","events_url":"https://api.github.com/users/snoozbuster/events{/privacy}","received_events_url":"https://api.github.com/users/snoozbuster/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ryneeverett/python-markdown-comments/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":27,"created_at":"2015-02-25T01:22:53Z","updated_at":"2015-03-05T23:00:10Z","closed_at":"2015-03-04T07:06:27Z","body":"It would be nice to be able to talk about the comments this tool provides inside of code blocks. I'm pretty sure that with a simple modification to the regex you should be able to support this.\r\n\r\nChange the regex in `_uncommented` from `.*<!---.*--->` to ``[^`(    )]*<!---.*--->``, and similarly for the multiline start comment (note that there is supposed to be exactly 4 spaces inside the parens). The idea is that `^` is \"not\", and then `` `(    )`` is \"tilde and at least four spaces\" (again, supposed to be exactly 4 spaces in the parens), so the two common ways of starting code blocks. Making these changes myself, the input\r\n\r\n    `<!--- test --->`\r\n    ` <!---- test -->` testing quote-single-space\r\n    \r\n    some text for testing `<!--- test -->` more text\r\n\r\n    inline testing <!--- test --> and more testing\r\n\r\n    I thought this would fail but it doesn't      <!--- test --> more text\r\n\r\n     <!--- testing single space --> this works too, hurray\r\n\r\n        <!--- test --> testing code blocks\r\n            <!--- test --> testing 8 spaces\r\n         <!--- test --> testing 5 spaces\r\n\r\nproduces the output:\r\n\r\n`<!--- test -->`\r\n\r\n`<!--- test -->` testing quote-single-space\r\n\r\nsome text for testing `<!--- test -->` more text\r\n\r\ninline testing and more testing\r\n\r\nI thought this would fail but it doesn't more text\r\n\r\nthis works too, hurray\r\n\r\n    <!--- test --> testing code blocks\r\n        <!--- test --> testing 8 spaces\r\n     <!--- test --> testing 5 spaces\r\n\r\nSo it seems to work even in cases where I thought it wouldn't; I'm not really sure why that is to be honest. I didn't try running the test cases with this modification, but I think if you tried they would work fine. I don't particularly feel like cloning and making the pull request, or testing the multiline comments, but I think this would be a good addition to the plugin."},"comment":{"url":"https://api.github.com/repos/ryneeverett/python-markdown-comments/issues/comments/77471232","html_url":"https://github.com/ryneeverett/python-markdown-comments/issues/2#issuecomment-77471232","issue_url":"https://api.github.com/repos/ryneeverett/python-markdown-comments/issues/2","id":77471232,"user":{"login":"snoozbuster","id":5778364,"avatar_url":"https://avatars.githubusercontent.com/u/5778364?v=3","gravatar_id":"","url":"https://api.github.com/users/snoozbuster","html_url":"https://github.com/snoozbuster","followers_url":"https://api.github.com/users/snoozbuster/followers","following_url":"https://api.github.com/users/snoozbuster/following{/other_user}","gists_url":"https://api.github.com/users/snoozbuster/gists{/gist_id}","starred_url":"https://api.github.com/users/snoozbuster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snoozbuster/subscriptions","organizations_url":"https://api.github.com/users/snoozbuster/orgs","repos_url":"https://api.github.com/users/snoozbuster/repos","events_url":"https://api.github.com/users/snoozbuster/events{/privacy}","received_events_url":"https://api.github.com/users/snoozbuster/received_events","type":"User","site_admin":false},"created_at":"2015-03-05T23:00:10Z","updated_at":"2015-03-05T23:00:10Z","body":"    $ python\r\n    >>> import markdown, mkdcomments\r\n    >>> md = markdown.Markdown(extensions=[\"mkdcomments:CommentsExtension\"])\r\n    >>> md.convert(\"some text `<!--- inline comment -->` more text example `<pre>` tag\")\r\n    u'<p>some text <code>` more text example</code><pre>` tag</p>'\r\n\r\nTo be fair, this isn't what the comments were designed to handle, and I figured out what Markdown is seeing, but that's still not at all what I'd expect to see from that.\r\n\r\nAdditionally, after some in-browser testing, although your test you added does pass, it doesn't do what you'd expect. HTML is still processed inside a `<pre>` block, so the comment is inserted into the HTML and promptly stripped by your browser. I think the `RawCommentReplacer` needs to escape the opening (and probably closing) angle bracket. The test should probably be changed to\r\n\r\n    def test_comments_in_html(self): \r\n         \"\"\" See issue #2. \"\"\" \r\n         md_input = \"\"\"\\ \r\n             <pre> \r\n                 <!--- test --> testing code blocks \r\n                     <!--- test --> testing 8 spaces \r\n                  <!--- test --> testing 5 spaces \r\n                 <!--- testing multiline comments\r\n                        more\r\n                        more\r\n                   -->\r\n             </pre>\"\"\" \r\n        md_output = \"\"\"\\ \r\n             <pre> \r\n                 &lt;!--- test --&gt; testing code blocks \r\n                     &lt;!--- test --&gt; testing 8 spaces \r\n                  &lt;!--- test --&gt testing 5 spaces \r\n                 &lt;!--- testing multiline comments\r\n                      more\r\n                      more\r\n                  --&gt;\r\n             </pre>\"\"\"\r\n         self.assertExpectedMarkdown(md_input, md_output) \r\n\r\nas well (but making sure the number of spaces on the multiline stuff is right)."}}