似乎Swagger UI正在扯掉并弄乱看起来像HTML标签的东西,即使在内部降价三重反引号分隔的代码块中!
我已经写了
swagger: '2.0'
info:
title: My Title
description: |
Hello here is some Python code
```
def hello():
return "hello"
```
and here is some HTML
```
<body>
<p>Hello</p>
<script>x = 1</script>
</body>
```
That is all
我并没有抱怨它没有在降价时使用highlight.js;它毕竟是一个开源项目,可以修复。但是,我注意到它剥离了HTML标签,这很好,除了当我试图像这样逃避尖括号时:
swagger: '2.0'
info:
title: My Title
description: |
Hello here is some Python code
```
def hello():
return "hello"
```
and here is some HTML
```
<body>
<p>Hello</p>
<script>x = 1</script>
</body>
```
That is all
然后工具回来了
有谁知道如何击败Swagger-UI并显示HTML代码片段?
Swagger UI v.3正确显示代码块中的HTML标记:
这是我使用的YAML:
description: |
Hello here is some Python code
```
def hello():
return "hello"
```
and here is some HTML
```
<body>
<p>Hello</p>
<script>x = 1</script>
</body>
```
That is all
注意:如果您的代码块存在如下所示的样式问题,请升级到Swagger UI 3.22.0+或Swagger Editor 3.6.26+。旧版本有一个CSS issue修复了上述版本。