看起来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代码段?
答案 0 :(得分:1)
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已在上述版本中修复。