We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Support for mathematical expressions in Markdown
**What's the problem this feature will solve?**
GitHub has [started supporting mathematical expressions in Markdown](https://github.blog/2022-05-19-math-support-in-markdown/).
It would be nice to have the same possibility in PyPi, since oftentimes the `README.md` on GitHub is used as `long_description` in `setup.py`. 
<!-- A clear and concise description of what the problem is. -->

**Describe the solution you'd like**
Implement the same syntax used by GitHub, described [here](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions).
<!-- A clear and concise description of what you want to happen. -->

**Additional context**
Example PyPi package for which math expressions are not rendered: https://pypi.org/project/sourcespec/ (section: "Theoretical background").
The original `README.md` on GitHub: https://github.com/SeismicSource/sourcespec/blob/master/README.md 
<!-- Add any other context, links, etc. about the feature here. -->


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `warehouse/csp.py`
Content:
```
1 # Licensed under the Apache License, Version 2.0 (the "License");
2 # you may not use this file except in compliance with the License.
3 # You may obtain a copy of the License at
4 #
5 # http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS,
9 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 # See the License for the specific language governing permissions and
11 # limitations under the License.
12 
13 import collections
14 import copy
15 
16 SELF = "'self'"
17 NONE = "'none'"
18 
19 
20 def _serialize(policy):
21     return "; ".join(
22         [
23             " ".join([k] + [v2 for v2 in v if v2 is not None])
24             for k, v in sorted(policy.items())
25         ]
26     )
27 
28 
29 def content_security_policy_tween_factory(handler, registry):
30     def content_security_policy_tween(request):
31         resp = handler(request)
32 
33         try:
34             policy = request.find_service(name="csp")
35         except LookupError:
36             policy = collections.defaultdict(list)
37 
38         # Replace CSP headers on /simple/ pages.
39         if request.path.startswith("/simple/"):
40             policy = collections.defaultdict(list)
41             policy["sandbox"] = ["allow-top-navigation"]
42             policy["default-src"] = [NONE]
43 
44         # We don't want to apply our Content Security Policy to the debug
45         # toolbar, that's not part of our application and it doesn't work with
46         # our restrictive CSP.
47         policy = _serialize(policy).format(request=request)
48         if not request.path.startswith("/_debug_toolbar/") and policy:
49             resp.headers["Content-Security-Policy"] = policy
50 
51         return resp
52 
53     return content_security_policy_tween
54 
55 
56 class CSPPolicy(collections.defaultdict):
57     def __init__(self, policy=None):
58         super().__init__(list, policy or {})
59 
60     def merge(self, policy):
61         for key, attrs in policy.items():
62             self[key].extend(attrs)
63 
64 
65 def csp_factory(_, request):
66     try:
67         return CSPPolicy(copy.deepcopy(request.registry.settings["csp"]))
68     except KeyError:
69         return CSPPolicy({})
70 
71 
72 def includeme(config):
73     config.register_service_factory(csp_factory, name="csp")
74     # Enable a Content Security Policy
75     config.add_settings(
76         {
77             "csp": {
78                 "base-uri": [SELF],
79                 "block-all-mixed-content": [],
80                 "connect-src": [
81                     SELF,
82                     "https://api.github.com/repos/",
83                     "fastly-insights.com",
84                     "*.fastly-insights.com",
85                     "*.ethicalads.io",
86                     "https://api.pwnedpasswords.com",
87                     # Scoped deeply to prevent other scripts calling other CDN resources
88                     "https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/sre/mathmaps/",
89                 ]
90                 + [
91                     item
92                     for item in [config.registry.settings.get("statuspage.url")]
93                     if item
94                 ],
95                 "default-src": [NONE],
96                 "font-src": [SELF, "fonts.gstatic.com"],
97                 "form-action": [SELF],
98                 "frame-ancestors": [NONE],
99                 "frame-src": [NONE],
100                 "img-src": [
101                     SELF,
102                     config.registry.settings["camo.url"],
103                     "www.google-analytics.com",
104                     "*.fastly-insights.com",
105                     "*.ethicalads.io",
106                 ],
107                 "script-src": [
108                     SELF,
109                     "www.googletagmanager.com",
110                     "www.google-analytics.com",
111                     "*.fastly-insights.com",
112                     "*.ethicalads.io",
113                     # Hash for v1.4.0 of ethicalads.min.js
114                     "'sha256-U3hKDidudIaxBDEzwGJApJgPEf2mWk6cfMWghrAa6i0='",
115                     "https://cdn.jsdelivr.net/npm/mathjax@3.2.2/",
116                     # Hash for v3.2.2 of MathJax tex-svg.js
117                     "'sha256-1CldwzdEg2k1wTmf7s5RWVd7NMXI/7nxxjJM2C4DqII='",
118                 ],
119                 "style-src": [
120                     SELF,
121                     "fonts.googleapis.com",
122                     "*.ethicalads.io",
123                     # Hashes for inline styles generated by v1.4.0 of ethicalads.min.js
124                     "'sha256-2YHqZokjiizkHi1Zt+6ar0XJ0OeEy/egBnlm+MDMtrM='",
125                     "'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='",
126                     # Hashes for inline styles generated by v3.2.2 of MathJax tex-svg.js
127                     "'sha256-JLEjeN9e5dGsz5475WyRaoA4eQOdNPxDIeUhclnJDCE='",
128                     "'sha256-mQyxHEuwZJqpxCw3SLmc4YOySNKXunyu2Oiz1r3/wAE='",
129                     "'sha256-OCf+kv5Asiwp++8PIevKBYSgnNLNUZvxAp4a7wMLuKA='",
130                     "'sha256-h5LOiLhk6wiJrGsG5ItM0KimwzWQH/yAcmoJDJL//bY='",
131                 ],
132                 "worker-src": ["*.fastly-insights.com"],
133             }
134         }
135     )
136     config.add_tween("warehouse.csp.content_security_policy_tween_factory")
137
```
--- 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()

```

diff --git a/warehouse/csp.py b/warehouse/csp.py
--- a/warehouse/csp.py
+++ b/warehouse/csp.py
@@ -115,6 +115,9 @@
                     "https://cdn.jsdelivr.net/npm/mathjax@3.2.2/",
                     # Hash for v3.2.2 of MathJax tex-svg.js
                     "'sha256-1CldwzdEg2k1wTmf7s5RWVd7NMXI/7nxxjJM2C4DqII='",
+                    # Hash for MathJax inline config
+                    # See warehouse/templates/packaging/detail.html
+                    "'sha256-0POaN8stWYQxhzjKS+/eOfbbJ/u4YHO5ZagJvLpMypo='",
                 ],
                 "style-src": [
                     SELF,

{"golden_diff": "diff --git a/warehouse/csp.py b/warehouse/csp.py\n--- a/warehouse/csp.py\n+++ b/warehouse/csp.py\n@@ -115,6 +115,9 @@\n                     \"https://cdn.jsdelivr.net/npm/mathjax@3.2.2/\",\n                     # Hash for v3.2.2 of MathJax tex-svg.js\n                     \"'sha256-1CldwzdEg2k1wTmf7s5RWVd7NMXI/7nxxjJM2C4DqII='\",\n+                    # Hash for MathJax inline config\n+                    # See warehouse/templates/packaging/detail.html\n+                    \"'sha256-0POaN8stWYQxhzjKS+/eOfbbJ/u4YHO5ZagJvLpMypo='\",\n                 ],\n                 \"style-src\": [\n                     SELF,\n", "issue": "Support for mathematical expressions in Markdown\n**What's the problem this feature will solve?**\r\nGitHub has [started supporting mathematical expressions in Markdown](https://github.blog/2022-05-19-math-support-in-markdown/).\r\nIt would be nice to have the same possibility in PyPi, since oftentimes the `README.md` on GitHub is used as `long_description` in `setup.py`. \r\n<!-- A clear and concise description of what the problem is. -->\r\n\r\n**Describe the solution you'd like**\r\nImplement the same syntax used by GitHub, described [here](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions).\r\n<!-- A clear and concise description of what you want to happen. -->\r\n\r\n**Additional context**\r\nExample PyPi package for which math expressions are not rendered: https://pypi.org/project/sourcespec/ (section: \"Theoretical background\").\r\nThe original `README.md` on GitHub: https://github.com/SeismicSource/sourcespec/blob/master/README.md \r\n<!-- Add any other context, links, etc. about the feature here. -->\r\n\n", "before_files": [{"content": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport collections\nimport copy\n\nSELF = \"'self'\"\nNONE = \"'none'\"\n\n\ndef _serialize(policy):\n    return \"; \".join(\n        [\n            \" \".join([k] + [v2 for v2 in v if v2 is not None])\n            for k, v in sorted(policy.items())\n        ]\n    )\n\n\ndef content_security_policy_tween_factory(handler, registry):\n    def content_security_policy_tween(request):\n        resp = handler(request)\n\n        try:\n            policy = request.find_service(name=\"csp\")\n        except LookupError:\n            policy = collections.defaultdict(list)\n\n        # Replace CSP headers on /simple/ pages.\n        if request.path.startswith(\"/simple/\"):\n            policy = collections.defaultdict(list)\n            policy[\"sandbox\"] = [\"allow-top-navigation\"]\n            policy[\"default-src\"] = [NONE]\n\n        # We don't want to apply our Content Security Policy to the debug\n        # toolbar, that's not part of our application and it doesn't work with\n        # our restrictive CSP.\n        policy = _serialize(policy).format(request=request)\n        if not request.path.startswith(\"/_debug_toolbar/\") and policy:\n            resp.headers[\"Content-Security-Policy\"] = policy\n\n        return resp\n\n    return content_security_policy_tween\n\n\nclass CSPPolicy(collections.defaultdict):\n    def __init__(self, policy=None):\n        super().__init__(list, policy or {})\n\n    def merge(self, policy):\n        for key, attrs in policy.items():\n            self[key].extend(attrs)\n\n\ndef csp_factory(_, request):\n    try:\n        return CSPPolicy(copy.deepcopy(request.registry.settings[\"csp\"]))\n    except KeyError:\n        return CSPPolicy({})\n\n\ndef includeme(config):\n    config.register_service_factory(csp_factory, name=\"csp\")\n    # Enable a Content Security Policy\n    config.add_settings(\n        {\n            \"csp\": {\n                \"base-uri\": [SELF],\n                \"block-all-mixed-content\": [],\n                \"connect-src\": [\n                    SELF,\n                    \"https://api.github.com/repos/\",\n                    \"fastly-insights.com\",\n                    \"*.fastly-insights.com\",\n                    \"*.ethicalads.io\",\n                    \"https://api.pwnedpasswords.com\",\n                    # Scoped deeply to prevent other scripts calling other CDN resources\n                    \"https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/sre/mathmaps/\",\n                ]\n                + [\n                    item\n                    for item in [config.registry.settings.get(\"statuspage.url\")]\n                    if item\n                ],\n                \"default-src\": [NONE],\n                \"font-src\": [SELF, \"fonts.gstatic.com\"],\n                \"form-action\": [SELF],\n                \"frame-ancestors\": [NONE],\n                \"frame-src\": [NONE],\n                \"img-src\": [\n                    SELF,\n                    config.registry.settings[\"camo.url\"],\n                    \"www.google-analytics.com\",\n                    \"*.fastly-insights.com\",\n                    \"*.ethicalads.io\",\n                ],\n                \"script-src\": [\n                    SELF,\n                    \"www.googletagmanager.com\",\n                    \"www.google-analytics.com\",\n                    \"*.fastly-insights.com\",\n                    \"*.ethicalads.io\",\n                    # Hash for v1.4.0 of ethicalads.min.js\n                    \"'sha256-U3hKDidudIaxBDEzwGJApJgPEf2mWk6cfMWghrAa6i0='\",\n                    \"https://cdn.jsdelivr.net/npm/mathjax@3.2.2/\",\n                    # Hash for v3.2.2 of MathJax tex-svg.js\n                    \"'sha256-1CldwzdEg2k1wTmf7s5RWVd7NMXI/7nxxjJM2C4DqII='\",\n                ],\n                \"style-src\": [\n                    SELF,\n                    \"fonts.googleapis.com\",\n                    \"*.ethicalads.io\",\n                    # Hashes for inline styles generated by v1.4.0 of ethicalads.min.js\n                    \"'sha256-2YHqZokjiizkHi1Zt+6ar0XJ0OeEy/egBnlm+MDMtrM='\",\n                    \"'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='\",\n                    # Hashes for inline styles generated by v3.2.2 of MathJax tex-svg.js\n                    \"'sha256-JLEjeN9e5dGsz5475WyRaoA4eQOdNPxDIeUhclnJDCE='\",\n                    \"'sha256-mQyxHEuwZJqpxCw3SLmc4YOySNKXunyu2Oiz1r3/wAE='\",\n                    \"'sha256-OCf+kv5Asiwp++8PIevKBYSgnNLNUZvxAp4a7wMLuKA='\",\n                    \"'sha256-h5LOiLhk6wiJrGsG5ItM0KimwzWQH/yAcmoJDJL//bY='\",\n                ],\n                \"worker-src\": [\"*.fastly-insights.com\"],\n            }\n        }\n    )\n    config.add_tween(\"warehouse.csp.content_security_policy_tween_factory\")\n", "path": "warehouse/csp.py"}], "after_files": [{"content": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport collections\nimport copy\n\nSELF = \"'self'\"\nNONE = \"'none'\"\n\n\ndef _serialize(policy):\n    return \"; \".join(\n        [\n            \" \".join([k] + [v2 for v2 in v if v2 is not None])\n            for k, v in sorted(policy.items())\n        ]\n    )\n\n\ndef content_security_policy_tween_factory(handler, registry):\n    def content_security_policy_tween(request):\n        resp = handler(request)\n\n        try:\n            policy = request.find_service(name=\"csp\")\n        except LookupError:\n            policy = collections.defaultdict(list)\n\n        # Replace CSP headers on /simple/ pages.\n        if request.path.startswith(\"/simple/\"):\n            policy = collections.defaultdict(list)\n            policy[\"sandbox\"] = [\"allow-top-navigation\"]\n            policy[\"default-src\"] = [NONE]\n\n        # We don't want to apply our Content Security Policy to the debug\n        # toolbar, that's not part of our application and it doesn't work with\n        # our restrictive CSP.\n        policy = _serialize(policy).format(request=request)\n        if not request.path.startswith(\"/_debug_toolbar/\") and policy:\n            resp.headers[\"Content-Security-Policy\"] = policy\n\n        return resp\n\n    return content_security_policy_tween\n\n\nclass CSPPolicy(collections.defaultdict):\n    def __init__(self, policy=None):\n        super().__init__(list, policy or {})\n\n    def merge(self, policy):\n        for key, attrs in policy.items():\n            self[key].extend(attrs)\n\n\ndef csp_factory(_, request):\n    try:\n        return CSPPolicy(copy.deepcopy(request.registry.settings[\"csp\"]))\n    except KeyError:\n        return CSPPolicy({})\n\n\ndef includeme(config):\n    config.register_service_factory(csp_factory, name=\"csp\")\n    # Enable a Content Security Policy\n    config.add_settings(\n        {\n            \"csp\": {\n                \"base-uri\": [SELF],\n                \"block-all-mixed-content\": [],\n                \"connect-src\": [\n                    SELF,\n                    \"https://api.github.com/repos/\",\n                    \"fastly-insights.com\",\n                    \"*.fastly-insights.com\",\n                    \"*.ethicalads.io\",\n                    \"https://api.pwnedpasswords.com\",\n                    # Scoped deeply to prevent other scripts calling other CDN resources\n                    \"https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/sre/mathmaps/\",\n                ]\n                + [\n                    item\n                    for item in [config.registry.settings.get(\"statuspage.url\")]\n                    if item\n                ],\n                \"default-src\": [NONE],\n                \"font-src\": [SELF, \"fonts.gstatic.com\"],\n                \"form-action\": [SELF],\n                \"frame-ancestors\": [NONE],\n                \"frame-src\": [NONE],\n                \"img-src\": [\n                    SELF,\n                    config.registry.settings[\"camo.url\"],\n                    \"www.google-analytics.com\",\n                    \"*.fastly-insights.com\",\n                    \"*.ethicalads.io\",\n                ],\n                \"script-src\": [\n                    SELF,\n                    \"www.googletagmanager.com\",\n                    \"www.google-analytics.com\",\n                    \"*.fastly-insights.com\",\n                    \"*.ethicalads.io\",\n                    # Hash for v1.4.0 of ethicalads.min.js\n                    \"'sha256-U3hKDidudIaxBDEzwGJApJgPEf2mWk6cfMWghrAa6i0='\",\n                    \"https://cdn.jsdelivr.net/npm/mathjax@3.2.2/\",\n                    # Hash for v3.2.2 of MathJax tex-svg.js\n                    \"'sha256-1CldwzdEg2k1wTmf7s5RWVd7NMXI/7nxxjJM2C4DqII='\",\n                    # Hash for MathJax inline config\n                    # See warehouse/templates/packaging/detail.html\n                    \"'sha256-0POaN8stWYQxhzjKS+/eOfbbJ/u4YHO5ZagJvLpMypo='\",\n                ],\n                \"style-src\": [\n                    SELF,\n                    \"fonts.googleapis.com\",\n                    \"*.ethicalads.io\",\n                    # Hashes for inline styles generated by v1.4.0 of ethicalads.min.js\n                    \"'sha256-2YHqZokjiizkHi1Zt+6ar0XJ0OeEy/egBnlm+MDMtrM='\",\n                    \"'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='\",\n                    # Hashes for inline styles generated by v3.2.2 of MathJax tex-svg.js\n                    \"'sha256-JLEjeN9e5dGsz5475WyRaoA4eQOdNPxDIeUhclnJDCE='\",\n                    \"'sha256-mQyxHEuwZJqpxCw3SLmc4YOySNKXunyu2Oiz1r3/wAE='\",\n                    \"'sha256-OCf+kv5Asiwp++8PIevKBYSgnNLNUZvxAp4a7wMLuKA='\",\n                    \"'sha256-h5LOiLhk6wiJrGsG5ItM0KimwzWQH/yAcmoJDJL//bY='\",\n                ],\n                \"worker-src\": [\"*.fastly-insights.com\"],\n            }\n        }\n    )\n    config.add_tween(\"warehouse.csp.content_security_policy_tween_factory\")\n", "path": "warehouse/csp.py"}]}