diff --git a/CHANGELOG.md b/CHANGELOG.md
index c66f9b97..cf5ee77e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ and this project tries to adhere to [Semantic Versioning](https://semver.org/spe
## [Unreleased]
### Added
+- markdown rendering
- link to changelog in docs panel
- progress bar to show simulation state
- WMS layers flurstuecke and ertragspotenzial
diff --git a/config/settings/base.py b/config/settings/base.py
index 044ea727..9bd46e4b 100644
--- a/config/settings/base.py
+++ b/config/settings/base.py
@@ -91,6 +91,7 @@
"rest_framework",
"django_distill",
"template_partials",
+ "markdownify.apps.MarkdownifyConfig",
]
LOCAL_APPS = ["digiplan.map.apps.MapConfig", "django_oemof", "django_mapengine"]
@@ -266,6 +267,15 @@ def __getitem__(self, item): # noqa: D105, ANN001, ANN204
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"
CRISPY_TEMPLATE_PACK = "bootstrap5"
+MARKDOWNIFY = {
+ "default": {
+ "BLEACH": False,
+ "MARKDOWN_EXTENSIONS": [
+ "markdown.extensions.extra",
+ ],
+ },
+}
+
OEMOF_SCENARIO = env.str("OEMOF_SCENARIO", "scenario_2045")
# django-mapengine
diff --git a/digiplan/map/config.py b/digiplan/map/config.py
index 0b494c3f..cb9c4b1d 100644
--- a/digiplan/map/config.py
+++ b/digiplan/map/config.py
@@ -28,6 +28,9 @@
ADDITIONAL_TRAFFIC_SETTINGS_FILE = settings.DATA_DIR.path("digipipe/settings/traffic_settings_panel.json")
TECHNOLOGY_DATA_FILE = settings.DIGIPIPE_DIR.path("scalars").path("technology_data.json")
+# MARKDOWNS
+LANDING_PAGE_MD = utils.read_file(settings.APPS_DIR.path("static/markdown/landing_page.md"))
+
# FILTERS
FILTER_DEFINITION = {}
REGION_FILTER_LAYERS = []
diff --git a/digiplan/map/utils.py b/digiplan/map/utils.py
index e8b30fd5..940a4cae 100644
--- a/digiplan/map/utils.py
+++ b/digiplan/map/utils.py
@@ -8,6 +8,12 @@
from django.template.context import make_context
+def read_file(filename: str) -> str:
+ """Read file."""
+ with pathlib.Path(filename).open("r", encoding="utf-8") as f:
+ return f.read()
+
+
def get_translated_json_from_file(json_filename: str, request: HttpRequest = None) -> dict:
"""
Render JSON using translations.
diff --git a/digiplan/map/views.py b/digiplan/map/views.py
index 90b9a41f..f6b55862 100644
--- a/digiplan/map/views.py
+++ b/digiplan/map/views.py
@@ -32,6 +32,7 @@ class MapGLView(TemplateView, views.MapEngineMixin):
"pv_map_control": _("Negativkriterien PV"),
"store_hot_init": config.STORE_HOT_INIT,
"oemof_scenario": settings.OEMOF_SCENARIO,
+ "markdown": {"landing_page": config.LANDING_PAGE_MD},
}
def get_context_data(self, **kwargs) -> dict:
diff --git a/digiplan/static/markdown/landing_page.md b/digiplan/static/markdown/landing_page.md
new file mode 100644
index 00000000..7b33e93c
--- /dev/null
+++ b/digiplan/static/markdown/landing_page.md
@@ -0,0 +1,15 @@
+# Test
+
+This is a test list:
+
+* a
+* b
+* c
+* d
+ * holla
+
+| Month | Savings |
+| -------- | ------- |
+| January | $250 |
+| February | $80 |
+| March | $420 |
diff --git a/digiplan/templates/components/map.html b/digiplan/templates/components/map.html
index c8b1e190..4a0200cc 100644
--- a/digiplan/templates/components/map.html
+++ b/digiplan/templates/components/map.html
@@ -1,4 +1,4 @@
-{% load static i18n %}
+{% load static i18n markdownify %}
{% include "components/onboarding.html" %}
@@ -23,23 +23,7 @@
Ziele
- Hier folgt noch Text zu diesen Punkten:
-
- - Vom Großen ins Kleine
- - Klimaziele und EE-Ziele Deutschland
- - Energiestrategie Brandenburg und Regionales Energiekonzept OLS
- - Stand Ausbau Wind & PV
- - Tool beleuchtet ausgewählte Aspekte, Beispiele
- - Beispielhafte Fragen aus Präsi:
-
- - Wie viel Energie kann auf den geplanten Windvorranggebieten "geerntet" werden?
- - Und wie viel mit Aufdach- und Agri-Photovoltaik?
- - Genügt das, um den zukünftigen Energiebedarf der Region zu decken, auch den der Wärmepumpen und Elektroautos?
- - Bis zu welchem Grad kann Oderland-Spree energetisch unabhängig werden?
- - Wie passt das zur Brandenburger Energiestrategie 2040?
-
-
-
+ {{ markdown.landing_page | markdownify }}
diff --git a/poetry.lock b/poetry.lock
index 2bcf602a..a00a4674 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -217,6 +217,24 @@ d = ["aiohttp (>=3.10)"]
jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
uvloop = ["uvloop (>=0.15.2)"]
+[[package]]
+name = "bleach"
+version = "6.2.0"
+description = "An easy safelist-based HTML-sanitizing tool."
+optional = false
+python-versions = ">=3.9"
+files = [
+ {file = "bleach-6.2.0-py3-none-any.whl", hash = "sha256:117d9c6097a7c3d22fd578fcd8d35ff1e125df6736f554da4e432fdd63f31e5e"},
+ {file = "bleach-6.2.0.tar.gz", hash = "sha256:123e894118b8a599fd80d3ec1a6d4cc7ce4e5882b1317a7e1ba69b56e95f991f"},
+]
+
+[package.dependencies]
+tinycss2 = {version = ">=1.1.0,<1.5", optional = true, markers = "extra == \"css\""}
+webencodings = "*"
+
+[package.extras]
+css = ["tinycss2 (>=1.1.0,<1.5)"]
+
[[package]]
name = "blinker"
version = "1.8.2"
@@ -998,6 +1016,22 @@ djangorestframework = ">=3.14.0,<4.0.0"
djangorestframework-mvt = ">=0.2.5,<0.3.0"
range-key-dict = ">=1.1.0,<2.0.0"
+[[package]]
+name = "django-markdownify"
+version = "0.9.5"
+description = "Markdown template filter for Django."
+optional = false
+python-versions = "*"
+files = [
+ {file = "django_markdownify-0.9.5-py3-none-any.whl", hash = "sha256:2c4ae44e386c209453caf5e9ea1b74f64535985d338ad2d5ad5e7089cc94be86"},
+ {file = "django_markdownify-0.9.5.tar.gz", hash = "sha256:34c34eba4a797282a5c5bd97b13cec84d6a4c0673ad47ce1c1d000d74dd8d4ab"},
+]
+
+[package.dependencies]
+bleach = {version = ">=5.0.0", extras = ["css"]}
+Django = "*"
+markdown = "*"
+
[[package]]
name = "django-oemof"
version = "0.18.1"
@@ -1634,6 +1668,24 @@ files = [
docutils = ">=0.19"
mistune = "0.8.4"
+[[package]]
+name = "markdown"
+version = "3.7"
+description = "Python implementation of John Gruber's Markdown."
+optional = false
+python-versions = ">=3.8"
+files = [
+ {file = "Markdown-3.7-py3-none-any.whl", hash = "sha256:7eb6df5690b81a1d7942992c97fad2938e956e79df20cbc6186e9c3a77b1c803"},
+ {file = "markdown-3.7.tar.gz", hash = "sha256:2ae2471477cfd02dbbf038d5d9bc226d40def84b4fe2986e49b59b6b472bbed2"},
+]
+
+[package.dependencies]
+importlib-metadata = {version = ">=4.4", markers = "python_version < \"3.10\""}
+
+[package.extras]
+docs = ["mdx-gh-links (>=0.2)", "mkdocs (>=1.5)", "mkdocs-gen-files", "mkdocs-literate-nav", "mkdocs-nature (>=0.6)", "mkdocs-section-index", "mkdocstrings[python]"]
+testing = ["coverage", "pyyaml"]
+
[[package]]
name = "markupsafe"
version = "3.0.1"
@@ -2854,6 +2906,24 @@ files = [
{file = "text_unidecode-1.3-py2.py3-none-any.whl", hash = "sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8"},
]
+[[package]]
+name = "tinycss2"
+version = "1.4.0"
+description = "A tiny CSS parser"
+optional = false
+python-versions = ">=3.8"
+files = [
+ {file = "tinycss2-1.4.0-py3-none-any.whl", hash = "sha256:3a49cf47b7675da0b15d0c6e1df8df4ebd96e9394bb905a5775adb0d884c5289"},
+ {file = "tinycss2-1.4.0.tar.gz", hash = "sha256:10c0972f6fc0fbee87c3edb76549357415e94548c1ae10ebccdea16fb404a9b7"},
+]
+
+[package.dependencies]
+webencodings = ">=0.4"
+
+[package.extras]
+doc = ["sphinx", "sphinx_rtd_theme"]
+test = ["pytest", "ruff"]
+
[[package]]
name = "tomli"
version = "2.0.2"
@@ -2993,6 +3063,17 @@ files = [
{file = "wcwidth-0.2.13.tar.gz", hash = "sha256:72ea0c06399eb286d978fdedb6923a9eb47e1c486ce63e9b4e64fc18303972b5"},
]
+[[package]]
+name = "webencodings"
+version = "0.5.1"
+description = "Character encoding aliases for legacy web content"
+optional = false
+python-versions = "*"
+files = [
+ {file = "webencodings-0.5.1-py2.py3-none-any.whl", hash = "sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78"},
+ {file = "webencodings-0.5.1.tar.gz", hash = "sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923"},
+]
+
[[package]]
name = "werkzeug"
version = "2.3.8"
@@ -3046,4 +3127,4 @@ type = ["pytest-mypy"]
[metadata]
lock-version = "2.0"
python-versions = ">=3.9,<3.12"
-content-hash = "c3bfc1d217874d23649524a9162b3be0eac6ee77b3a93a5e5cf605f6451398b4"
+content-hash = "17046760aba24d7a3a1f1e2aeff9d9220ba9692b62766424a61f51639eed746d"
diff --git a/pyproject.toml b/pyproject.toml
index e07f9cff..32480d2b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -41,6 +41,7 @@ geojson = "^3.0.1"
oemof-network = "0.5.0a5"
django-template-partials = "^23.4"
django-cache-memoize = "^0.2.0"
+django-markdownify = "^0.9.5"
[tool.poetry.group.dev.dependencies]
Werkzeug = "^2.0.1" # https://github.com/pallets/werkzeug