We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Page preview doesn't consider format
Page preview needs to take into account format when previewing

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `CTFd/admin/pages.py`
Content:
```
1 from flask import render_template, request
2 
3 from CTFd.admin import admin
4 from CTFd.models import Pages
5 from CTFd.schemas.pages import PageSchema
6 from CTFd.utils import markdown
7 from CTFd.utils.decorators import admins_only
8 
9 
10 @admin.route("/admin/pages")
11 @admins_only
12 def pages_listing():
13     pages = Pages.query.all()
14     return render_template("admin/pages.html", pages=pages)
15 
16 
17 @admin.route("/admin/pages/new")
18 @admins_only
19 def pages_new():
20     return render_template("admin/editor.html")
21 
22 
23 @admin.route("/admin/pages/preview", methods=["POST"])
24 @admins_only
25 def pages_preview():
26     # We only care about content.
27     # Loading other attributes improperly will cause Marshmallow to incorrectly return a dict
28     data = {"content": request.form.get("content")}
29     schema = PageSchema()
30     page = schema.load(data)
31     return render_template("page.html", content=page.data.html)
32 
33 
34 @admin.route("/admin/pages/<int:page_id>")
35 @admins_only
36 def pages_detail(page_id):
37     page = Pages.query.filter_by(id=page_id).first_or_404()
38     page_op = request.args.get("operation")
39 
40     if request.method == "GET" and page_op == "preview":
41         return render_template("page.html", content=markdown(page.content))
42 
43     if request.method == "GET" and page_op == "create":
44         return render_template("admin/editor.html")
45 
46     return render_template("admin/editor.html", page=page)
47
```
--- 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/CTFd/admin/pages.py b/CTFd/admin/pages.py
--- a/CTFd/admin/pages.py
+++ b/CTFd/admin/pages.py
@@ -25,7 +25,10 @@
 def pages_preview():
     # We only care about content.
     # Loading other attributes improperly will cause Marshmallow to incorrectly return a dict
-    data = {"content": request.form.get("content")}
+    data = {
+        "content": request.form.get("content"),
+        "format": request.form.get("format"),
+    }
     schema = PageSchema()
     page = schema.load(data)
     return render_template("page.html", content=page.data.html)

{"golden_diff": "diff --git a/CTFd/admin/pages.py b/CTFd/admin/pages.py\n--- a/CTFd/admin/pages.py\n+++ b/CTFd/admin/pages.py\n@@ -25,7 +25,10 @@\n def pages_preview():\n     # We only care about content.\n     # Loading other attributes improperly will cause Marshmallow to incorrectly return a dict\n-    data = {\"content\": request.form.get(\"content\")}\n+    data = {\n+        \"content\": request.form.get(\"content\"),\n+        \"format\": request.form.get(\"format\"),\n+    }\n     schema = PageSchema()\n     page = schema.load(data)\n     return render_template(\"page.html\", content=page.data.html)\n", "issue": "Page preview doesn't consider format\nPage preview needs to take into account format when previewing\n", "before_files": [{"content": "from flask import render_template, request\n\nfrom CTFd.admin import admin\nfrom CTFd.models import Pages\nfrom CTFd.schemas.pages import PageSchema\nfrom CTFd.utils import markdown\nfrom CTFd.utils.decorators import admins_only\n\n\n@admin.route(\"/admin/pages\")\n@admins_only\ndef pages_listing():\n    pages = Pages.query.all()\n    return render_template(\"admin/pages.html\", pages=pages)\n\n\n@admin.route(\"/admin/pages/new\")\n@admins_only\ndef pages_new():\n    return render_template(\"admin/editor.html\")\n\n\n@admin.route(\"/admin/pages/preview\", methods=[\"POST\"])\n@admins_only\ndef pages_preview():\n    # We only care about content.\n    # Loading other attributes improperly will cause Marshmallow to incorrectly return a dict\n    data = {\"content\": request.form.get(\"content\")}\n    schema = PageSchema()\n    page = schema.load(data)\n    return render_template(\"page.html\", content=page.data.html)\n\n\n@admin.route(\"/admin/pages/<int:page_id>\")\n@admins_only\ndef pages_detail(page_id):\n    page = Pages.query.filter_by(id=page_id).first_or_404()\n    page_op = request.args.get(\"operation\")\n\n    if request.method == \"GET\" and page_op == \"preview\":\n        return render_template(\"page.html\", content=markdown(page.content))\n\n    if request.method == \"GET\" and page_op == \"create\":\n        return render_template(\"admin/editor.html\")\n\n    return render_template(\"admin/editor.html\", page=page)\n", "path": "CTFd/admin/pages.py"}], "after_files": [{"content": "from flask import render_template, request\n\nfrom CTFd.admin import admin\nfrom CTFd.models import Pages\nfrom CTFd.schemas.pages import PageSchema\nfrom CTFd.utils import markdown\nfrom CTFd.utils.decorators import admins_only\n\n\n@admin.route(\"/admin/pages\")\n@admins_only\ndef pages_listing():\n    pages = Pages.query.all()\n    return render_template(\"admin/pages.html\", pages=pages)\n\n\n@admin.route(\"/admin/pages/new\")\n@admins_only\ndef pages_new():\n    return render_template(\"admin/editor.html\")\n\n\n@admin.route(\"/admin/pages/preview\", methods=[\"POST\"])\n@admins_only\ndef pages_preview():\n    # We only care about content.\n    # Loading other attributes improperly will cause Marshmallow to incorrectly return a dict\n    data = {\n        \"content\": request.form.get(\"content\"),\n        \"format\": request.form.get(\"format\"),\n    }\n    schema = PageSchema()\n    page = schema.load(data)\n    return render_template(\"page.html\", content=page.data.html)\n\n\n@admin.route(\"/admin/pages/<int:page_id>\")\n@admins_only\ndef pages_detail(page_id):\n    page = Pages.query.filter_by(id=page_id).first_or_404()\n    page_op = request.args.get(\"operation\")\n\n    if request.method == \"GET\" and page_op == \"preview\":\n        return render_template(\"page.html\", content=markdown(page.content))\n\n    if request.method == \"GET\" and page_op == \"create\":\n        return render_template(\"admin/editor.html\")\n\n    return render_template(\"admin/editor.html\", page=page)\n", "path": "CTFd/admin/pages.py"}]}