prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Format event description
  As a planner, I want to be able to format the event description. This should at least mean that links will be formatted so that they are clickable. Maybe this should mean that the description will accept Markdown.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `ephios/extra/templatetags/rich_text.py`
  Content:
  ```
  1 import bleach
  2 import markdown
  3 from django import template
  4 from django.utils.safestring import mark_safe
  5 
  6 register = template.Library()
  7 
  8 ALLOWED_TAGS = [
  9     "a",
  10     "abbr",
  11     "acronym",
  12     "b",
  13     "blockquote",
  14     "br",
  15     "code",
  16     "div",
  17     "em",
  18     "h1",
  19     "h2",
  20     "h3",
  21     "h4",
  22     "h5",
  23     "h6",
  24     "hr",
  25     "i",
  26     "li",
  27     "ol",
  28     "p",
  29     "pre",
  30     "span",
  31     "strong",
  32     "table",
  33     "tbody",
  34     "td",
  35     "th",
  36     "thead",
  37     "tr",
  38     "ul",
  39 ]
  40 
  41 
  42 ALLOWED_ATTRIBUTES = {
  43     "a": ["href", "title", "class"],
  44     "abbr": ["title"],
  45     "acronym": ["title"],
  46     "table": ["width"],
  47     "td": ["width", "align"],
  48     "div": ["class"],
  49     "p": ["class"],
  50     "span": ["class", "title"],
  51 }
  52 
  53 ALLOWED_PROTOCOLS = ["http", "https", "mailto", "tel"]
  54 
  55 
  56 def markdown_compile(source):
  57     extensions = ["markdown.extensions.sane_lists", "markdown.extensions.nl2br"]
  58     return bleach.clean(
  59         markdown.markdown(source, extensions=extensions),
  60         tags=ALLOWED_TAGS,
  61         attributes=ALLOWED_ATTRIBUTES,
  62         protocols=ALLOWED_PROTOCOLS,
  63     )
  64 
  65 
  66 @register.filter
  67 def rich_text(text: str, **kwargs):
  68     """
  69     Processes markdown and cleans HTML in a text input.
  70     """
  71     text = str(text)
  72     linker = bleach.Linker(parse_email=True)
  73     body_md = linker.linkify(markdown_compile(text))
  74     return mark_safe(body_md)
  75
  ```
  --- 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/ephios/extra/templatetags/rich_text.py b/ephios/extra/templatetags/rich_text.py
  --- a/ephios/extra/templatetags/rich_text.py
  +++ b/ephios/extra/templatetags/rich_text.py
  @@ -53,22 +53,28 @@
   ALLOWED_PROTOCOLS = ["http", "https", "mailto", "tel"]
   
   
  -def markdown_compile(source):
  +def markdown_compile(source, excluded_tags=""):
       extensions = ["markdown.extensions.sane_lists", "markdown.extensions.nl2br"]
  +    tags = ALLOWED_TAGS.copy()
  +    for tag in excluded_tags.split(","):
  +        try:
  +            tags.remove(tag)
  +        except ValueError:
  +            pass
       return bleach.clean(
           markdown.markdown(source, extensions=extensions),
  -        tags=ALLOWED_TAGS,
  +        tags=tags,
           attributes=ALLOWED_ATTRIBUTES,
           protocols=ALLOWED_PROTOCOLS,
       )
   
   
   @register.filter
  -def rich_text(text: str, **kwargs):
  +def rich_text(text: str, excluded_tags=""):
       """
       Processes markdown and cleans HTML in a text input.
       """
       text = str(text)
       linker = bleach.Linker(parse_email=True)
  -    body_md = linker.linkify(markdown_compile(text))
  +    body_md = linker.linkify(markdown_compile(text, excluded_tags=excluded_tags))
       return mark_safe(body_md)
  
verification_info: {"golden_diff": "diff --git a/ephios/extra/templatetags/rich_text.py b/ephios/extra/templatetags/rich_text.py\n--- a/ephios/extra/templatetags/rich_text.py\n+++ b/ephios/extra/templatetags/rich_text.py\n@@ -53,22 +53,28 @@\n ALLOWED_PROTOCOLS = [\"http\", \"https\", \"mailto\", \"tel\"]\n \n \n-def markdown_compile(source):\n+def markdown_compile(source, excluded_tags=\"\"):\n     extensions = [\"markdown.extensions.sane_lists\", \"markdown.extensions.nl2br\"]\n+    tags = ALLOWED_TAGS.copy()\n+    for tag in excluded_tags.split(\",\"):\n+        try:\n+            tags.remove(tag)\n+        except ValueError:\n+            pass\n     return bleach.clean(\n         markdown.markdown(source, extensions=extensions),\n-        tags=ALLOWED_TAGS,\n+        tags=tags,\n         attributes=ALLOWED_ATTRIBUTES,\n         protocols=ALLOWED_PROTOCOLS,\n     )\n \n \n @register.filter\n-def rich_text(text: str, **kwargs):\n+def rich_text(text: str, excluded_tags=\"\"):\n     \"\"\"\n     Processes markdown and cleans HTML in a text input.\n     \"\"\"\n     text = str(text)\n     linker = bleach.Linker(parse_email=True)\n-    body_md = linker.linkify(markdown_compile(text))\n+    body_md = linker.linkify(markdown_compile(text, excluded_tags=excluded_tags))\n     return mark_safe(body_md)\n", "issue": "Format event description\nAs a planner, I want to be able to format the event description. This should at least mean that links will be formatted so that they are clickable. Maybe this should mean that the description will accept Markdown.\n", "before_files": [{"content": "import bleach\nimport markdown\nfrom django import template\nfrom django.utils.safestring import mark_safe\n\nregister = template.Library()\n\nALLOWED_TAGS = [\n    \"a\",\n    \"abbr\",\n    \"acronym\",\n    \"b\",\n    \"blockquote\",\n    \"br\",\n    \"code\",\n    \"div\",\n    \"em\",\n    \"h1\",\n    \"h2\",\n    \"h3\",\n    \"h4\",\n    \"h5\",\n    \"h6\",\n    \"hr\",\n    \"i\",\n    \"li\",\n    \"ol\",\n    \"p\",\n    \"pre\",\n    \"span\",\n    \"strong\",\n    \"table\",\n    \"tbody\",\n    \"td\",\n    \"th\",\n    \"thead\",\n    \"tr\",\n    \"ul\",\n]\n\n\nALLOWED_ATTRIBUTES = {\n    \"a\": [\"href\", \"title\", \"class\"],\n    \"abbr\": [\"title\"],\n    \"acronym\": [\"title\"],\n    \"table\": [\"width\"],\n    \"td\": [\"width\", \"align\"],\n    \"div\": [\"class\"],\n    \"p\": [\"class\"],\n    \"span\": [\"class\", \"title\"],\n}\n\nALLOWED_PROTOCOLS = [\"http\", \"https\", \"mailto\", \"tel\"]\n\n\ndef markdown_compile(source):\n    extensions = [\"markdown.extensions.sane_lists\", \"markdown.extensions.nl2br\"]\n    return bleach.clean(\n        markdown.markdown(source, extensions=extensions),\n        tags=ALLOWED_TAGS,\n        attributes=ALLOWED_ATTRIBUTES,\n        protocols=ALLOWED_PROTOCOLS,\n    )\n\n\n@register.filter\ndef rich_text(text: str, **kwargs):\n    \"\"\"\n    Processes markdown and cleans HTML in a text input.\n    \"\"\"\n    text = str(text)\n    linker = bleach.Linker(parse_email=True)\n    body_md = linker.linkify(markdown_compile(text))\n    return mark_safe(body_md)\n", "path": "ephios/extra/templatetags/rich_text.py"}], "after_files": [{"content": "import bleach\nimport markdown\nfrom django import template\nfrom django.utils.safestring import mark_safe\n\nregister = template.Library()\n\nALLOWED_TAGS = [\n    \"a\",\n    \"abbr\",\n    \"acronym\",\n    \"b\",\n    \"blockquote\",\n    \"br\",\n    \"code\",\n    \"div\",\n    \"em\",\n    \"h1\",\n    \"h2\",\n    \"h3\",\n    \"h4\",\n    \"h5\",\n    \"h6\",\n    \"hr\",\n    \"i\",\n    \"li\",\n    \"ol\",\n    \"p\",\n    \"pre\",\n    \"span\",\n    \"strong\",\n    \"table\",\n    \"tbody\",\n    \"td\",\n    \"th\",\n    \"thead\",\n    \"tr\",\n    \"ul\",\n]\n\n\nALLOWED_ATTRIBUTES = {\n    \"a\": [\"href\", \"title\", \"class\"],\n    \"abbr\": [\"title\"],\n    \"acronym\": [\"title\"],\n    \"table\": [\"width\"],\n    \"td\": [\"width\", \"align\"],\n    \"div\": [\"class\"],\n    \"p\": [\"class\"],\n    \"span\": [\"class\", \"title\"],\n}\n\nALLOWED_PROTOCOLS = [\"http\", \"https\", \"mailto\", \"tel\"]\n\n\ndef markdown_compile(source, excluded_tags=\"\"):\n    extensions = [\"markdown.extensions.sane_lists\", \"markdown.extensions.nl2br\"]\n    tags = ALLOWED_TAGS.copy()\n    for tag in excluded_tags.split(\",\"):\n        try:\n            tags.remove(tag)\n        except ValueError:\n            pass\n    return bleach.clean(\n        markdown.markdown(source, extensions=extensions),\n        tags=tags,\n        attributes=ALLOWED_ATTRIBUTES,\n        protocols=ALLOWED_PROTOCOLS,\n    )\n\n\n@register.filter\ndef rich_text(text: str, excluded_tags=\"\"):\n    \"\"\"\n    Processes markdown and cleans HTML in a text input.\n    \"\"\"\n    text = str(text)\n    linker = bleach.Linker(parse_email=True)\n    body_md = linker.linkify(markdown_compile(text, excluded_tags=excluded_tags))\n    return mark_safe(body_md)\n", "path": "ephios/extra/templatetags/rich_text.py"}]}