aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabui2020-11-26 17:18:35 +0300
committerAlexander Kabui2020-11-26 17:18:35 +0300
commit66f4ab80a5dbfa8634c3a5df91a59a9119f57b2c (patch)
tree30dacf642ff4792edf1bc508744fa84a11c8b870
parentd8fb319272a4833ed3045cdc5ed46e0e204f78e1 (diff)
downloadgenenetwork2-66f4ab80a5dbfa8634c3a5df91a59a9119f57b2c.tar.gz
add table extension to support conversion of markdown tables to HTML
-rw-r--r--wqflask/wqflask/markdown_routes.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/wqflask/wqflask/markdown_routes.py b/wqflask/wqflask/markdown_routes.py
index 5170fcf0..073370c7 100644
--- a/wqflask/wqflask/markdown_routes.py
+++ b/wqflask/wqflask/markdown_routes.py
@@ -20,7 +20,24 @@ github_url = ("https://raw.githubusercontent.com/"
+
+def render_markdown_table(file_name,github_url="https://raw.githubusercontent.com/Alexanderlacuna/gn-docs/feature/add-markdown-pages/"):
+
+ md_content=md_content=requests.get(f"{github_url}{file_name}")
+ if md_content.status_code==200:
+ return markdown.markdown(md_content.content.decode("utf-8"), extensions=['tables'])
+ return (f"\nContent for {file_name} not available. "
+ "Please check "
+ "(here to see where content exists)"
+ "[https://github.com/genenetwork/gn-docs]. "
+ "Please reach out to the gn2 team to have a look at this")
+
+
+
+
def render_markdown(file_name,github_url="https://raw.githubusercontent.com/Alexanderlacuna/gn-docs/feature/add-markdown-pages/"):
+ github_url = ("https://raw.githubusercontent.com/"
+ "genenetwork/gn-docs/master/")
md_content=requests.get(f"{github_url}{file_name}")
"""Try to fetch the file name from Github and if that fails, try to
@@ -60,7 +77,7 @@ def references():
@environments_blueprint.route("/")
def environments():
- return render_template("environments.html", rendered_markdown=render_markdown("general/links/links.md"))
+ return render_template("environment.html", rendered_markdown=render_markdown_table("general/environments/environments.md")),200
@links_blueprint.route("/")