diff --git a/content/pages/a_page.md b/content/pages/a_page.md index f37368f..e8f4205 100644 --- a/content/pages/a_page.md +++ b/content/pages/a_page.md @@ -8,7 +8,30 @@ template_engine jinja2 } --- +{% from "widgets/page_header.html" import page_header %} +

Page 1

-

Go to page 2

\ No newline at end of file +

Go to page 2

+ + +
+{% markdown %} +``` +This is markdown : +``` +test +**test** +`test` +{% endmarkdown %} +
+ + +{{ page_header( + markdown(' +test +**test** +`test` + ') +) }} diff --git a/jssg/jinja2.py b/jssg/jinja2.py index dcbbf73..8c87f1b 100644 --- a/jssg/jinja2.py +++ b/jssg/jinja2.py @@ -1,6 +1,6 @@ from django.templatetags.static import static from django.urls import reverse - +from django_jinja_markdown.templatetags.md import markdown from jinja2 import Environment from jssg.templatetags.filter_opengraph_metadata import filter_opengraph_metadata @@ -91,6 +91,7 @@ def environment(**options): { "static": static, "url": reverse, + "markdown": markdown, "url_for_slug": url_for_slug, "url_for_slug_path" : url_for_slug_path } diff --git a/jssg/settings.py b/jssg/settings.py index a0ce03b..71e6f44 100644 --- a/jssg/settings.py +++ b/jssg/settings.py @@ -59,6 +59,7 @@ INSTALLED_APPS = [ "jssg", + "django_jinja_markdown", "django.contrib.contenttypes", "whitenoise.runserver_nostatic", "django.contrib.staticfiles", @@ -80,7 +81,8 @@ "DIRS": [path / "jinja2" for path in JFME_TEMPLATES_DIRS], "APP_DIRS": True, "OPTIONS": { - "environment": "jssg.jinja2.environment" + "environment": "jssg.jinja2.environment", + "extensions": ["django_jinja_markdown.extensions.MarkdownExtension"] }, }, { diff --git a/requirements.txt b/requirements.txt index c196e9e..ec36189 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ -Django==5.0.6 +Django==4.2.9 django-distill django_vite_plugin==3.0.0 markdown2[all]==2.4.13 whitenoise==6.7.0 Jinja2==3.1.4 +django-jinja-markdown \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 984c649..40307d7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,7 +19,30 @@ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "paths": { + "@/*": [ + "./*" + ], + "@s:django_jinja_markdown/*": [ + "./env/lib/python3.9/site-packages/django_jinja_markdown/static/django_jinja_markdown/*" + ], + "@t:django_jinja_markdown/*": [ + "./env/lib/python3.9/site-packages/django_jinja_markdown/templates/django_jinja_markdown/*" + ], + "@s:django_distill/*": [ + "./env/lib/python3.9/site-packages/django_distill/static/django_distill/*" + ], + "@t:django_distill/*": [ + "./env/lib/python3.9/site-packages/django_distill/templates/django_distill/*" + ], + "@s:jssg/*": [ + "./jssg/static/jssg/*" + ], + "@t:jssg/*": [ + "./jssg/templates/jssg/*" + ] + } }, "include": [ "content/front/"