有没有办法在
JSON
中很好地格式化/样式 Github Wiki
代码(即首选 Markdown)?
类似这样的颜色很少(或粗体)并且缩进正确的东西:
可以使用以下块代码语法应用一些颜色语法丰富
```json
Here goes your json object definition
```
注意: 这不会美化 json 表示。为此,人们可以事先依赖外部服务,例如 jsbeautifier.org,并将美化后的结果粘贴到 wiki 中。
```javascript
{ "some": "json" }
```
我尝试使用
json
但不喜欢它的外观。 javascript
看起来更顺眼一点。
```yaml
{
"this-json": "looks awesome..."
}
### Result
[![enter image description here][1]][1]
If you want to have keys a different colour to the values, set your language as `yaml`
[@Ankanna's answer][2] gave me the idea of going through [github's supported language list][3] and `yaml` was my best find. (No other language had keys a different colour to values on github).
Also you can use comments in `yaml` with `//`
[1]: https://i.stack.imgur.com/ElxM5.png
[2]: https://stackoverflow.com/a/46811028/2217801
[3]: http://www.rubycoloredglasses.com/2013/04/languages-supported-by-github-flavored-markdown/