To clarify, the <section .. shown above was in the
sidebar.html.twig customisation of the Learn2 template.
it uses the Twig markdown_to_html filter on the included file
footer.markdown.twig
which contains the test line shown
I don;t know if my line of code is incorrect or markdown_to_html doesn't work within the Grav implementation.
Note:
I'm not a fan of using Twig containing Markdown. I prefer to keep functional layers separate: Page content = Markdown, page layout = Twig, etc.
Remember that Twig will be transpiled into a PHP file (and cached), which will contain, amongst others, a function doDisplay() which echoes your Markdown. Eg. echo "# Hello world!";
<?phpuseTwig\Environment;useTwig\Error\LoaderError;useTwig\Error\RuntimeError;useTwig\Markup;useTwig\Sandbox\SecurityError;useTwig\Sandbox\SecurityNotAllowedTagError;useTwig\Sandbox\SecurityNotAllowedFilterError;useTwig\Sandbox\SecurityNotAllowedFunctionError;useTwig\Source;useTwig\Template;/* partials/footer.markdown.twig */class__TwigTemplate_58a49df49dc86a7170e4a043b7ff747fc552b4dca18d00964cae8907b276f81fextends\Twig\Template{publicfunction__construct(Environment$env){parent::__construct($env);$this->parent=false;$this->blocks=[];}protectedfunctiondoDisplay(array$context,array$blocks=[]){// line 1echo"# Hello world!";}publicfunctiongetTemplateName(){return"partials/footer.markdown.twig";}publicfunctiongetDebugInfo(){returnarray(30=>1,);}/**@deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */publicfunctiongetSource(){@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.',E_USER_DEPRECATED);return$this->getSourceContext()->getCode();}publicfunctiongetSourceContext(){returnnewSource("# Hello world!","partials/footer.markdown.twig","/www/grav/site-dev/user/themes/quark/templates/partials/footer.markdown.twig");}}
</details>
You may have a compelling reason for using Markdown inside Twig of course.
I would prefer to keep layers separate and would therefor use something like:
A file containing reusable content, e.g. /user/pages/includes/footer/default.md containing the markdown/content