File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/Text.Templating.Razor Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,20 @@ Formatted data: @this.Formatter.Format(Model)
155155
156156As long as ` IDateTimeProvider ` and ` IMyFormatter ` are registered in the ` IServiceCollection ` , they are available during template rendering.
157157
158+ ## HTML rendering and character encoding
159+
160+ The output of Razor templates is standard HTML. This means that special characters (including accents)
161+ are HTML-encoded by default when using expressions like ` @Model.Name ` .
162+
163+ If you need to output already-encoded or raw HTML content from your model, you must explicitly disable HTML
164+ encoding in your Razor template, for example:
165+
166+ ``` razor
167+ @Html.Raw(Model.Name)
168+ ```
169+
170+ Use this only when you are sure that the content is safe (to avoid XSS vulnerabilities).
171+
158172## Links
159173
160174- [ NuGet package: Emailing.Templates.Razor] ( https://www.nuget.org/packages/PosInformatique.Foundations.Emailing.Templates.Razor/ )
You can’t perform that action at this time.
0 commit comments