如何在 Github Wiki 中设置 JSON 块的样式?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14901245/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to style JSON block in Github Wiki?
提问by HP.
Is there a way to nicely format/style JSON code in Github Wiki (i.e Markdown preferred)?
有没有办法在 Github Wiki 中很好地格式化/样式化 JSON 代码(即首选 Markdown)?
Something like this with few colors (or bold) and correct indentation: http://www.freeformatter.com/json-formatter.html#ad-output
像这样的颜色很少(或粗体)和正确的缩进:http: //www.freeformatter.com/json-formatter.html#ad-output
回答by nulltoken
Some color-syntaxing enrichment can be applied with the following blockcode syntax
可以使用以下块代码语法应用一些颜色语法丰富
```json
Here goes your json object definition
```
Note:This won't prettify the json representation. To do so, one can previously rely on an external service such as jsbeautifier.organd paste the prettified result in the wiki.
注意:这不会美化 json 表示。为此,您可以之前依赖于jsbeautifier.org等外部服务并将美化后的结果粘贴到 wiki 中。
回答by jc00ke
```javascript
{ "some": "json" }
```
I tried using jsonbut didn't like the way it looked. javascriptlooks a bit more pleasing to my eye.
我尝试使用json但不喜欢它的外观。javascript看起来更顺眼一点。
回答by Ankanna
I encountered the same problem. So, I tried representing the JSONin different Language syntax formats.But all time favorites are Perl, js, python, & elixir.
我遇到了同样的问题。所以,我尝试JSON用不同的语言语法格式来表示 。但所有时间最喜欢的是Perl, js, python, & elixir。
This is how it looks.
这是它的样子。
The following screenshots are from the Gitlabin a markdown file.
This may vary based on the colors using for syntax in MARKDOWNfiles.
以下屏幕截图来自Gitlabmarkdown 文件中。这可能会因MARKDOWN文件中使用 for 语法的颜色而异。
回答by Jesse Reza Khorasanee
2019 Github Solution
2019 Github 解决方案
```yaml
{
"this-json": "looks awesome..."
}
Result
结果
If you want to have keys a different colour to the parameters, set your language as yaml
如果您想为参数设置不同颜色的键,请将您的语言设置为 yaml
@Ankanna's answergave me the idea of going through github's supported language listand yamlwas my best find.
@ Ankanna的回答给了我通过的念头GitHub的支持的语言列表,并yaml是我最好的发现。


