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 both html and markdown contents #20

Closed
lebouquetin opened this issue Jun 27, 2024 · 4 comments
Closed

Allow both html and markdown contents #20

lebouquetin opened this issue Jun 27, 2024 · 4 comments

Comments

@lebouquetin
Copy link
Member

Historycally, JSSG allows markdown content and process it as markdown.

Markdown can includes html but this has some side effects because indentation is interpreted in markdown - so html code must not include indentation For this reason, the source code has been hacked in order to avoid markdown processing.

Expected:

As a content writer, I want to be able to write parts of content as markdown. This is way faster than writing HTML and almost required for blog writting.

A clever way to implement this looks like including the jinja-markdown extension, so that I can write some content body like this:

<section class="showcase">
    <div class="container-fluid p-0">
{% markdown %}
### Third level title

a paragraphe of text, then an unordered list:

- first item
- second item
- third item

{% endmarkdown %}
    </div>
</section>
@ClmntBcqt
Copy link
Contributor

ClmntBcqt commented Jul 24, 2024

Using django-jinja-markdown extension, we can also use markdown as function or filter (filter is not implemented, but it's easy to add). The advantage is that it allows to pass markdown in argument in Jinja2 templates.
For instance :

{{ widget(
    CONTENT = markdown("This is **markdown**")
) }}

@ClmntBcqt
Copy link
Contributor

Merged in #35

@lebouquetin
Copy link
Member Author

I'm not sure to understand @ClmntBcqt . Is this implemented or not?

My state of understanding is the following one:

[x] We can implement markdown like this:

{% markdown %}
# here comes markdown text
## with subtitles

And also *simple markdown*

Even some python source code with triple ticks

{% endmarkdown %}

[x] We can implement markdown like this:

{{ widget(
    CONTENT = markdown("This is **markdown**")
) }}

[ ] We can't implement markdown using filters like:

{{ MarkdownContent | markdown }}

Do I understand correctly?

@ClmntBcqt
Copy link
Contributor

That's it
Should we add the possibility to use filter ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants