查看GitHub评论的原始Markdown

duf*_*ffn 7 github

如何在GitHub问题中查看评论的降价?例如,我想查看组成此评论的Markdown:https : //github.com/jashkenas/backbone/issues/3857#issue-116738665

use*_*745 6

只需替换以下 URL 中的用户名、reponame 和问题编号:

https://api.github.com/repos/USERNAME/REPONAME/issues/NUMBER/comments

Run Code Online (Sandbox Code Playgroud)

是一个例子

  • 为了快速参考,您可以通过将其粘贴到浏览器控制台 `await fetch('https://api.github.com/repos/:username/: reponame/issues/:issue_id/comments').then(resp => resp.json()).then(comments => comments[n].body)` (2认同)

Von*_*onC 5

首先,第一篇文章是实际问题本身,无法访问,但GitHub 问题 API

https://api.github.com/repos/jashkenas/backbone/issues/3857/comments

该列表只有 3 条评论,因为第一篇文章不是评论。

问题本身有一个格式化的正文:

https://api.github.com/repos/jashkenas/backbone/issues/3857

那返回:

  "body": "In Safari , pass a path using unicode string to `navigate` method  like this\r\n\r\n```js\r\nBackbone.history.navigate('/city/??',{trigger:true});\r\n```\r\nThe hash is incorrect. It output\r\n\r\n```js\r\nlocation.hash\r\n//> #/city/%17%AC\r\n```\r\n\r\nI tracked the code, it caused by `_updateHash` method.\r\n\r\nThe call stack created by  `History.prototype.navigate` method like this\r\n\r\n* navigate\r\n   -  decodeFragment\r\n   - _updateHash\r\n\r\nThe fragment passed to `_updateHash`,  was decoded by `decodeFragment`, so the hash was incorrect?\r\n\r\nI also searched the commit history, the `decodeFragment` added in \"1.2.0\"\r\n\r\nPS: My english is not good, although I am trying to improve\r\n\r\n",
Run Code Online (Sandbox Code Playgroud)

那不完全是mardown:

    In Safari , pass a path using unicode string to `navigate` method  like this

```js\r\nBackbone.history.navigate('/city/??',{trigger:true});
```\r\nThe hash is incorrect. It output

```js\r\nlocation.hash
//> #/city/%17%AC
```

I tracked the code, it caused by `_updateHash` method.

The call stack created by  `History.prototype.navigate` method like this

* navigate
   -  decodeFragment
   - _updateHash
The fragment passed to `_updateHash`,  was decoded by `decodeFragment`, so the hash was incorrect?
I also searched the commit history, the `decodeFragment` added in \"1.2.0\"
PS: My english is not good, although I am trying to improve
Run Code Online (Sandbox Code Playgroud)

本期第二条评论有两张图片,所以那些花哨的效果没有markdow:

https://cloud.githubusercontent.com/assets/516562/11164567/62f9ddf6-8b2f-11e5-8aa8-631c1aa84422.gif

https://cloud.githubusercontent.com/assets/516562/11164567/62f9ddf6-8b2f-11e5-8aa8-631c1aa84422.gif

[https://jsfiddle.net/leexiaosi/uyp3o6ek/](https://jsfiddle.net/leexiaosi/uyp3o6ek/)

**notice!!!** : please open in safari.

### the record of safari
![safari](https://cloud.githubusercontent.com/assets/516562/11164567/62f9ddf6-8b2f-11e5-8aa8-631c1aa84422.gif)

### the record of chrome
![chrome](https://cloud.githubusercontent.com/assets/516562/11164583/c66d1b82-8b2f-11e5-9d88-ecba16ae6167.gif)
Run Code Online (Sandbox Code Playgroud)