Syntax Highlighting
1.0.0You may provide little snippets of code using markdown syntax and they will be color coded based on the language you specified as shown below
```java
some code...
...
...
```
Following are the supported language codes that you may use for syntax highlighting
bashshellmarkuphtmlxmlsvgjsonyamlymlgojavascriptjsjavapythonpycsharpcshttpcss
No Highlight
$ curl -X POST -is -u username:password
-H "Content-Type: application/json" https://example.com
-d '{
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "master"
}
}'
SHELL shell bash
$ curl -X POST -is -u username:password
-H "Content-Type: application/json" https://example.com
-d '{
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "master"
}
}'
MARKUP markup html xml svg
<!doctype html>
<html>
<head>
<meta charset="utf-8"> <!-- Important: rapi-doc uses utf8 characters -->
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
</head>
<body>
<rapi-doc spec-url="https://petstore.swagger.io/v2/swagger.json"> </rapi-doc>
</body>
</html>
JSON json
{
"firstName": "Mickey",
"lastName": "Mouse",
"age": 9,
"married": false,
}
YAML yaml yml
openapi: 3.0.0
info:
title: Syntax Highlighting
version: 1.0.0
description: >
Example of
Syntax highlighting
GO go
func readFileAsLines(path string) ([]string, error) {
d, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}
s := string(d)
res := strings.Split(s, "\n")
return res, nil
}
JAVA SCRIPT javascript js
function add(x, y) {
const answer = x + y;
return answer;
}
for (let i = 0; i < 10; i++){
console.log(3, i); // prints in console
}
JAVA java
BufferedWriter out = null;
try {
out = new BufferedWriter(new FileWriter(”filename”, true));
out.write(”aString”);
} catch (IOException e) {
// error processing code
} finally {
if (out != null) {
out.close();
}
}
PYTHON python py
@app.route('/parse_data', methods=['GET', 'POST'])
# define the function
def parse_data():
if request.method == 'POST':
search = request.get_json()
return jsonify(search)
return render_template('index.html')
C SHARP chsarp cs
using System.IO.Compression;
namespace MyApplication {
[Obsolete("...")]
class Program : IInterface {
public static List<int> JustDoIt(int count) {
Console.WriteLine($"Hello {Name}!");
return new List<int>(new int[] { 1, 2, 3 })
}
}
}
HTTP http
POST /pet HTTP/1.1
Host: example.org
Content-Type: application/json; charset=utf-8
Content-Length: 137
{
"status": "ok",
"extended": true,
"results": [
{"value": 0, "type": "int64"},
{"value": 1.0e+3, "type": "decimal"}
]
}