added mermaid support in row shortcode

This commit is contained in:
timurgordon 2022-02-24 15:17:52 +03:00
parent 6c1f296147
commit d7f299b924
3 changed files with 23 additions and 1 deletions

View File

@ -19,9 +19,14 @@ test
{% end %} {% end %}
{% row() %}
## My example mermaid diagram ## My example mermaid diagram
I wanted to use mermaid in this project, and it looks like this I wanted to use mermaid in this project, and it looks like this
|||
{% mermaid() %} {% mermaid() %}
classDiagram classDiagram

View File

@ -8,6 +8,7 @@ insert_anchor_links: "left"
#first: "first" #first: "first"
#last: "last" #last: "last"
template: "blog/blog.html" template: "blog/blog.html"
page_template: "blogPage.html"
#transparent: true #transparent: true
extra: extra:
imgPath: /images/threefold_img2.png imgPath: /images/threefold_img2.png

View File

@ -9,7 +9,6 @@ Parameters:
- bgPath: if bgPath is passed, the row has a full width background - bgPath: if bgPath is passed, the row has a full width background
--> -->
{% set columns = body | safe | markdown | split(pat="|||") %} {% set columns = body | safe | markdown | split(pat="|||") %}
{% set classes = "relative pt-12 flex flex-col md:flex-row lg:flex-row p-8 sm:p-12 md:p-16 lg:p-20 lg:py-16"%} {% set classes = "relative pt-12 flex flex-col md:flex-row lg:flex-row p-8 sm:p-12 md:p-16 lg:p-20 lg:py-16"%}
@ -41,10 +40,27 @@ Parameters:
{% set classes = classes ~ " lg:py-40" %} {% set classes = classes ~ " lg:py-40" %}
{% endif %} {% endif %}
<div class="{{classes}}" style="{{styles}}"> <div class="{{classes}}" style="{{styles}}">
{% for column in columns%} {% for column in columns%}
<div class="{{column_classes}}"> <div class="{{column_classes}}">
{% if "{% mermaid() %}" in column %}
{% set mermaid_section = column | safe | markdown | split(pat="{% mermaid() %}") %}
{% set mermaid_content = mermaid_section[1] | striptags | replace(from="", to="--")%}
<div class="mermaid">
{{mermaid_content | safe }} yo
</div>
{% else %}
{{ column | safe }} {{ column | safe }}
{% endif %}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>