Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow markdown content #35

Merged
merged 5 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion content/pages/a_page.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,26 @@ template_engine jinja2
}

---
{% from "widgets/page_header.html" import page_header %}


<h2>Page 1</h2>

<p>Go to <a href="{{ url_for_slug('page2') }}">page 2</a> </p>
<p>Go to <a href="{{ url('page', args=['page2']) }}">page 2</a> </p>

<article>
{% markdown %}
lebouquetin marked this conversation as resolved.
Show resolved Hide resolved
```
This is markdown.
```
{% endmarkdown %}
</article>


{{ page_header(
markdown('
test
**test**
`test`
')
) }}
3 changes: 2 additions & 1 deletion jssg/jinja2.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 3 additions & 1 deletion jssg/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

INSTALLED_APPS = [
"jssg",
"django_jinja_markdown",
"django.contrib.contenttypes",
"whitenoise.runserver_nostatic",
"django.contrib.staticfiles",
Expand All @@ -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"]
},
},
{
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
25 changes: 24 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
Loading