Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Gantry

Markdown particle for Gantry 5

Solved by Erik View solution

Started by Erik 9 years ago · 2 replies · 1924 views
9 years ago

Hi!

I am trying for the first time to set up a website with Grav and Gantry 5. I am a bit puzzeled that there is no particle for markdown, but only html? Or am I mistaken?

Anyways, I tried to create one for myself, and this is what I came up with.
It appears in the Gantry backend, I can enable it and put Markdown text in it, but it is not displayed on the side that I've placed it. What am I missing?

Inside \user\data\gantry5\themes\g5_helium\particles I've placed:

custom_markdown.html.twig

TWIG
{% extends '@nucleus/partials/particle.html.twig' %}

{% block particle %}
<div class="{{ particle.css.class }}">
    {{ particle.markdown|markdown }}
</div>
{% endblock %}

custom_markdown.yaml

YAML
name: Custom Markdown
description: Same as Custom HTML, only with Markdown parsing
type: particle
icon: fa-code

form:
  fields:
    enabled:
      type: input.checkbox
      label: Enabled
      description: Globally enable to the particles.
      default: true

    markdown:
      type: textarea.textarea
      label: Markdown
      description: Create or modify your description.

    css.class:
      type: input.text
      label: Class
      description: CSS class name for the particle.
9 years ago Solution

Silly me! I had forgotten to assign the outline to the page. Now, I can see the text, however, it prints with the HTML tags as text... so I then found out that I needed to append '|raw', and voila, now it works! 🙂

7 years ago

Thanks, I'm happy to have discovered your solution!

Edit: Actually, I get an error: " Error while rendering custom_markdown particle."

last edited 11/02/19 by paul

Suggested topics

Topic Participants Replies Views Activity
Gantry · by Chris, 11 months ago
1 172 11 months ago
Gantry · by Sam, 1 year ago
7 220 1 year ago
Gantry · by Dima, 2 years ago
2 75 2 years ago
Gantry · by KimTaeWoong, 9 years ago
2 1883 3 years ago
Gantry · by stani, 6 years ago
2 831 3 years ago