prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Docs: template autoescaping behavior
  ### Summary
  
  I appreciate this framework having a built-in choice between Jinja and Mako.  The documentation however makes no mention of a significant difference in the Litestar behavior between the two -- that using the Jinja engine will autoescape for you, whereas Mako will not.  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `litestar/contrib/mako.py`
  Content:
  ```
  1 from __future__ import annotations
  2 
  3 from functools import partial
  4 from typing import TYPE_CHECKING, Any, Callable
  5 
  6 from litestar.exceptions import MissingDependencyException, TemplateNotFoundException
  7 from litestar.template.base import (
  8     TemplateEngineProtocol,
  9     TemplateProtocol,
  10     csrf_token,
  11     url_for,
  12     url_for_static_asset,
  13 )
  14 
  15 __all__ = ("MakoTemplate", "MakoTemplateEngine")
  16 
  17 
  18 try:
  19     import mako  # noqa: F401
  20 except ImportError as e:
  21     raise MissingDependencyException("mako") from e
  22 
  23 
  24 from mako.exceptions import TemplateLookupException as MakoTemplateNotFound
  25 from mako.lookup import TemplateLookup
  26 
  27 if TYPE_CHECKING:
  28     from mako.template import Template as _MakoTemplate
  29     from pydantic import DirectoryPath
  30 
  31 
  32 class MakoTemplate(TemplateProtocol):
  33     """Mako template, implementing ``TemplateProtocol``"""
  34 
  35     def __init__(self, template: _MakoTemplate, template_callables: list[tuple[str, Callable[[dict[str, Any]], Any]]]):
  36         """Initialize a template.
  37 
  38         Args:
  39             template: Base ``MakoTemplate`` used by the underlying mako-engine
  40             template_callables: List of callables passed to the template
  41         """
  42         super().__init__()
  43         self.template = template
  44         self.template_callables = template_callables
  45 
  46     def render(self, *args: Any, **kwargs: Any) -> str:
  47         """Render a template.
  48 
  49         Args:
  50             args: Positional arguments passed to the engines ``render`` function
  51             kwargs: Keyword arguments passed to the engines ``render`` function
  52 
  53         Returns:
  54             Rendered template as a string
  55         """
  56         for callable_key, template_callable in self.template_callables:
  57             kwargs_copy = {**kwargs}
  58             kwargs[callable_key] = partial(template_callable, kwargs_copy)
  59 
  60         return str(self.template.render(*args, **kwargs))
  61 
  62 
  63 class MakoTemplateEngine(TemplateEngineProtocol[MakoTemplate]):
  64     """Mako based TemplateEngine."""
  65 
  66     def __init__(self, directory: DirectoryPath | list[DirectoryPath]) -> None:
  67         """Initialize template engine.
  68 
  69         Args:
  70             directory: Direct path or list of directory paths from which to serve templates.
  71         """
  72         super().__init__(directory=directory)
  73         self.engine = TemplateLookup(directories=directory if isinstance(directory, (list, tuple)) else [directory])
  74         self._template_callables: list[tuple[str, Callable[[dict[str, Any]], Any]]] = []
  75         self.register_template_callable(key="url_for_static_asset", template_callable=url_for_static_asset)  # type: ignore
  76         self.register_template_callable(key="csrf_token", template_callable=csrf_token)  # type: ignore
  77         self.register_template_callable(key="url_for", template_callable=url_for)  # type: ignore
  78 
  79     def get_template(self, template_name: str) -> MakoTemplate:
  80         """Retrieve a template by matching its name (dotted path) with files in the directory or directories provided.
  81 
  82         Args:
  83             template_name: A dotted path
  84 
  85         Returns:
  86             MakoTemplate instance
  87 
  88         Raises:
  89             TemplateNotFoundException: if no template is found.
  90         """
  91         try:
  92             return MakoTemplate(
  93                 template=self.engine.get_template(template_name), template_callables=self._template_callables
  94             )
  95         except MakoTemplateNotFound as exc:
  96             raise TemplateNotFoundException(template_name=template_name) from exc
  97 
  98     def register_template_callable(self, key: str, template_callable: Callable[[dict[str, Any]], Any]) -> None:
  99         """Register a callable on the template engine.
  100 
  101         Args:
  102             key: The callable key, i.e. the value to use inside the template to call the callable.
  103             template_callable: A callable to register.
  104 
  105         Returns:
  106             None
  107         """
  108         self._template_callables.append((key, template_callable))
  109
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/litestar/contrib/mako.py b/litestar/contrib/mako.py
  --- a/litestar/contrib/mako.py
  +++ b/litestar/contrib/mako.py
  @@ -70,7 +70,9 @@
               directory: Direct path or list of directory paths from which to serve templates.
           """
           super().__init__(directory=directory)
  -        self.engine = TemplateLookup(directories=directory if isinstance(directory, (list, tuple)) else [directory])
  +        self.engine = TemplateLookup(
  +            directories=directory if isinstance(directory, (list, tuple)) else [directory], default_filters=["h"]
  +        )
           self._template_callables: list[tuple[str, Callable[[dict[str, Any]], Any]]] = []
           self.register_template_callable(key="url_for_static_asset", template_callable=url_for_static_asset)  # type: ignore
           self.register_template_callable(key="csrf_token", template_callable=csrf_token)  # type: ignore
  
verification_info: {"golden_diff": "diff --git a/litestar/contrib/mako.py b/litestar/contrib/mako.py\n--- a/litestar/contrib/mako.py\n+++ b/litestar/contrib/mako.py\n@@ -70,7 +70,9 @@\n             directory: Direct path or list of directory paths from which to serve templates.\n         \"\"\"\n         super().__init__(directory=directory)\n-        self.engine = TemplateLookup(directories=directory if isinstance(directory, (list, tuple)) else [directory])\n+        self.engine = TemplateLookup(\n+            directories=directory if isinstance(directory, (list, tuple)) else [directory], default_filters=[\"h\"]\n+        )\n         self._template_callables: list[tuple[str, Callable[[dict[str, Any]], Any]]] = []\n         self.register_template_callable(key=\"url_for_static_asset\", template_callable=url_for_static_asset)  # type: ignore\n         self.register_template_callable(key=\"csrf_token\", template_callable=csrf_token)  # type: ignore\n", "issue": "Docs: template autoescaping behavior\n### Summary\r\n\r\nI appreciate this framework having a built-in choice between Jinja and Mako.  The documentation however makes no mention of a significant difference in the Litestar behavior between the two -- that using the Jinja engine will autoescape for you, whereas Mako will not.  \n", "before_files": [{"content": "from __future__ import annotations\n\nfrom functools import partial\nfrom typing import TYPE_CHECKING, Any, Callable\n\nfrom litestar.exceptions import MissingDependencyException, TemplateNotFoundException\nfrom litestar.template.base import (\n    TemplateEngineProtocol,\n    TemplateProtocol,\n    csrf_token,\n    url_for,\n    url_for_static_asset,\n)\n\n__all__ = (\"MakoTemplate\", \"MakoTemplateEngine\")\n\n\ntry:\n    import mako  # noqa: F401\nexcept ImportError as e:\n    raise MissingDependencyException(\"mako\") from e\n\n\nfrom mako.exceptions import TemplateLookupException as MakoTemplateNotFound\nfrom mako.lookup import TemplateLookup\n\nif TYPE_CHECKING:\n    from mako.template import Template as _MakoTemplate\n    from pydantic import DirectoryPath\n\n\nclass MakoTemplate(TemplateProtocol):\n    \"\"\"Mako template, implementing ``TemplateProtocol``\"\"\"\n\n    def __init__(self, template: _MakoTemplate, template_callables: list[tuple[str, Callable[[dict[str, Any]], Any]]]):\n        \"\"\"Initialize a template.\n\n        Args:\n            template: Base ``MakoTemplate`` used by the underlying mako-engine\n            template_callables: List of callables passed to the template\n        \"\"\"\n        super().__init__()\n        self.template = template\n        self.template_callables = template_callables\n\n    def render(self, *args: Any, **kwargs: Any) -> str:\n        \"\"\"Render a template.\n\n        Args:\n            args: Positional arguments passed to the engines ``render`` function\n            kwargs: Keyword arguments passed to the engines ``render`` function\n\n        Returns:\n            Rendered template as a string\n        \"\"\"\n        for callable_key, template_callable in self.template_callables:\n            kwargs_copy = {**kwargs}\n            kwargs[callable_key] = partial(template_callable, kwargs_copy)\n\n        return str(self.template.render(*args, **kwargs))\n\n\nclass MakoTemplateEngine(TemplateEngineProtocol[MakoTemplate]):\n    \"\"\"Mako based TemplateEngine.\"\"\"\n\n    def __init__(self, directory: DirectoryPath | list[DirectoryPath]) -> None:\n        \"\"\"Initialize template engine.\n\n        Args:\n            directory: Direct path or list of directory paths from which to serve templates.\n        \"\"\"\n        super().__init__(directory=directory)\n        self.engine = TemplateLookup(directories=directory if isinstance(directory, (list, tuple)) else [directory])\n        self._template_callables: list[tuple[str, Callable[[dict[str, Any]], Any]]] = []\n        self.register_template_callable(key=\"url_for_static_asset\", template_callable=url_for_static_asset)  # type: ignore\n        self.register_template_callable(key=\"csrf_token\", template_callable=csrf_token)  # type: ignore\n        self.register_template_callable(key=\"url_for\", template_callable=url_for)  # type: ignore\n\n    def get_template(self, template_name: str) -> MakoTemplate:\n        \"\"\"Retrieve a template by matching its name (dotted path) with files in the directory or directories provided.\n\n        Args:\n            template_name: A dotted path\n\n        Returns:\n            MakoTemplate instance\n\n        Raises:\n            TemplateNotFoundException: if no template is found.\n        \"\"\"\n        try:\n            return MakoTemplate(\n                template=self.engine.get_template(template_name), template_callables=self._template_callables\n            )\n        except MakoTemplateNotFound as exc:\n            raise TemplateNotFoundException(template_name=template_name) from exc\n\n    def register_template_callable(self, key: str, template_callable: Callable[[dict[str, Any]], Any]) -> None:\n        \"\"\"Register a callable on the template engine.\n\n        Args:\n            key: The callable key, i.e. the value to use inside the template to call the callable.\n            template_callable: A callable to register.\n\n        Returns:\n            None\n        \"\"\"\n        self._template_callables.append((key, template_callable))\n", "path": "litestar/contrib/mako.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom functools import partial\nfrom typing import TYPE_CHECKING, Any, Callable\n\nfrom litestar.exceptions import MissingDependencyException, TemplateNotFoundException\nfrom litestar.template.base import (\n    TemplateEngineProtocol,\n    TemplateProtocol,\n    csrf_token,\n    url_for,\n    url_for_static_asset,\n)\n\n__all__ = (\"MakoTemplate\", \"MakoTemplateEngine\")\n\n\ntry:\n    import mako  # noqa: F401\nexcept ImportError as e:\n    raise MissingDependencyException(\"mako\") from e\n\n\nfrom mako.exceptions import TemplateLookupException as MakoTemplateNotFound\nfrom mako.lookup import TemplateLookup\n\nif TYPE_CHECKING:\n    from mako.template import Template as _MakoTemplate\n    from pydantic import DirectoryPath\n\n\nclass MakoTemplate(TemplateProtocol):\n    \"\"\"Mako template, implementing ``TemplateProtocol``\"\"\"\n\n    def __init__(self, template: _MakoTemplate, template_callables: list[tuple[str, Callable[[dict[str, Any]], Any]]]):\n        \"\"\"Initialize a template.\n\n        Args:\n            template: Base ``MakoTemplate`` used by the underlying mako-engine\n            template_callables: List of callables passed to the template\n        \"\"\"\n        super().__init__()\n        self.template = template\n        self.template_callables = template_callables\n\n    def render(self, *args: Any, **kwargs: Any) -> str:\n        \"\"\"Render a template.\n\n        Args:\n            args: Positional arguments passed to the engines ``render`` function\n            kwargs: Keyword arguments passed to the engines ``render`` function\n\n        Returns:\n            Rendered template as a string\n        \"\"\"\n        for callable_key, template_callable in self.template_callables:\n            kwargs_copy = {**kwargs}\n            kwargs[callable_key] = partial(template_callable, kwargs_copy)\n\n        return str(self.template.render(*args, **kwargs))\n\n\nclass MakoTemplateEngine(TemplateEngineProtocol[MakoTemplate]):\n    \"\"\"Mako based TemplateEngine.\"\"\"\n\n    def __init__(self, directory: DirectoryPath | list[DirectoryPath]) -> None:\n        \"\"\"Initialize template engine.\n\n        Args:\n            directory: Direct path or list of directory paths from which to serve templates.\n        \"\"\"\n        super().__init__(directory=directory)\n        self.engine = TemplateLookup(\n            directories=directory if isinstance(directory, (list, tuple)) else [directory], default_filters=[\"h\"]\n        )\n        self._template_callables: list[tuple[str, Callable[[dict[str, Any]], Any]]] = []\n        self.register_template_callable(key=\"url_for_static_asset\", template_callable=url_for_static_asset)  # type: ignore\n        self.register_template_callable(key=\"csrf_token\", template_callable=csrf_token)  # type: ignore\n        self.register_template_callable(key=\"url_for\", template_callable=url_for)  # type: ignore\n\n    def get_template(self, template_name: str) -> MakoTemplate:\n        \"\"\"Retrieve a template by matching its name (dotted path) with files in the directory or directories provided.\n\n        Args:\n            template_name: A dotted path\n\n        Returns:\n            MakoTemplate instance\n\n        Raises:\n            TemplateNotFoundException: if no template is found.\n        \"\"\"\n        try:\n            return MakoTemplate(\n                template=self.engine.get_template(template_name), template_callables=self._template_callables\n            )\n        except MakoTemplateNotFound as exc:\n            raise TemplateNotFoundException(template_name=template_name) from exc\n\n    def register_template_callable(self, key: str, template_callable: Callable[[dict[str, Any]], Any]) -> None:\n        \"\"\"Register a callable on the template engine.\n\n        Args:\n            key: The callable key, i.e. the value to use inside the template to call the callable.\n            template_callable: A callable to register.\n\n        Returns:\n            None\n        \"\"\"\n        self._template_callables.append((key, template_callable))\n", "path": "litestar/contrib/mako.py"}]}