aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content/administration/mail-templates.en-us.md
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-03-01 18:16:19 +0800
committerGitHub <noreply@github.com>2024-03-01 10:16:19 +0000
commitfb42972c057364a1dc99dfb528554e7a94415be7 (patch)
tree162d9e043c62df788f438ae2bb65983e301f8517 /docs/content/administration/mail-templates.en-us.md
parentcb52b17f92e2d2293f7c003649743464492bca48 (diff)
downloadgitea-fb42972c057364a1dc99dfb528554e7a94415be7.tar.gz
gitea-fb42972c057364a1dc99dfb528554e7a94415be7.zip
Rename Str2html to SanitizeHTML and clarify its behavior (#29516)
Str2html was abused a lot. So use a proper name for it: SanitizeHTML And add some tests to show its behavior.
Diffstat (limited to 'docs/content/administration/mail-templates.en-us.md')
-rw-r--r--docs/content/administration/mail-templates.en-us.md10
1 files changed, 5 insertions, 5 deletions
diff --git a/docs/content/administration/mail-templates.en-us.md b/docs/content/administration/mail-templates.en-us.md
index b642ff4aa7..9077f97aea 100644
--- a/docs/content/administration/mail-templates.en-us.md
+++ b/docs/content/administration/mail-templates.en-us.md
@@ -224,7 +224,7 @@ Please check [Gitea's logs](administration/logging-config.md) for error messages
{{if not (eq .Body "")}}
<h3>Message content</h3>
<hr>
- {{.Body | Str2html}}
+ {{.Body | SanitizeHTML}}
{{end}}
</p>
<hr>
@@ -260,19 +260,19 @@ The template system contains several functions that can be used to further proce
the messages. Here's a list of some of them:
| Name | Parameters | Available | Usage |
-| ---------------- | ----------- | --------- | --------------------------------------------------------------------------- |
+| ---------------- | ----------- | --------- |-----------------------------------------------------------------------------|
| `AppUrl` | - | Any | Gitea's URL |
| `AppName` | - | Any | Set from `app.ini`, usually "Gitea" |
| `AppDomain` | - | Any | Gitea's host name |
| `EllipsisString` | string, int | Any | Truncates a string to the specified length; adds ellipsis as needed |
-| `Str2html` | string | Body only | Sanitizes text by removing any HTML tags from it. |
+| `SanitizeHTML` | string | Body only | Sanitizes text by removing any dangerous HTML tags from it. |
| `SafeHTML` | string | Body only | Takes the input as HTML; can be used for `.ReviewComments.RenderedContent`. |
These are _functions_, not metadata, so they have to be used:
```html
-Like this: {{Str2html "Escape<my>text"}}
-Or this: {{"Escape<my>text" | Str2html}}
+Like this: {{SanitizeHTML "Escape<my>text"}}
+Or this: {{"Escape<my>text" | SanitizeHTML}}
Or this: {{AppUrl}}
But not like this: {{.AppUrl}}
```