Skip to content

Commit 6aa53a2

Browse files
authored
fix: enable disabling of safeHTML in Swagger middleware documentation (#1532)
1 parent 56b0d97 commit 6aa53a2

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

content/en/docs/hertz/tutorials/third-party/middleware/swagger.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ date: 2025-12-04
44
weight: 8
55
keywords: ["Swagger", "RESTful API"]
66
description: "Generate RESTful API documentation with the official Swagger toolchain and HTTP adaptor."
7+
disableSafeHTML: true
78
---
89

910
> **⚠️ Deprecated**

content/zh/docs/hertz/tutorials/third-party/middleware/swagger.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ date: 2025-12-04
44
weight: 8
55
keywords: ["Swagger", "RESTful API"]
66
description: "使用官方 Swagger 工具链和 HTTP Adaptor 生成 RESTful API 文档"
7+
disableSafeHTML: true
78
---
89

910
> **⚠️ 已废弃**

layouts/partials/copy-to-llm.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@
2424
</div>
2525

2626
{{/* Embed raw markdown for copy-as-markdown */}}
27-
<script id="copy-fulltext-markdown" type="text/plain">{{ .RawContent | safeHTML }}</script>
27+
{{/* Allow front matter to disable safeHTML for XSS safety */}}
28+
<script id="copy-fulltext-markdown" type="text/plain">{{ if .Params.disableSafeHTML }}{{ .RawContent }}{{ else }}{{ .RawContent | safeHTML }}{{ end }}</script>

0 commit comments

Comments
 (0)