diff --git a/docs/docs/views/templates/functions/index.md b/docs/docs/views/templates/functions/index.md index 11c6e942..7318cb78 100644 --- a/docs/docs/views/templates/functions/index.md +++ b/docs/docs/views/templates/functions/index.md @@ -106,7 +106,6 @@ Inserts JavaScript code which will create and initialize a [Turbo Stream](../../ [^1]: [https://turbo.hotwired.dev/handbook/streams](https://turbo.hotwired.dev/handbook/streams) - ### `render` Renders a template directly inside the current template. Can be used for rendering [partials](../partials.md). `<%%` is a special template code tag which is an alias for `render`. @@ -122,3 +121,23 @@ Renders a template directly inside the current template. Can be used for renderi <%% "templates/profile.html" %> ``` + +### `csrf_token` + +Renders an input field with a valid [CSRF](../../../security/CSRF.md) token. + +```html +
+ <%= csrf_token() %> +
+``` + + +### `csrf_token_raw` + +Renders a valid [CSRF](../../../security/CSRF.md) token as a raw HTML string. It can then be passed to JavaScript via a `data-` attribute or a global variable: + +```html +
+```