grav-plugin-shortcode-core icon indicating copy to clipboard operation
grav-plugin-shortcode-core copied to clipboard

Nested shortcodes broken in flex objects content

Open schliflo opened this issue 3 years ago • 5 comments

My setup renders flex objects that have markdown content. The template looks like this

{{ object.markdown|shortcodes|markdown|raw }}

The following markdown

[div]
[div]
*test*
[/div]
[/div]

renders like this:

<div>
<div></div>
*test*
</div>
[/div]

Using the same markdown in the page content (not the flex object) it produces the correct/expected output:

<div >
<div >
<p><em>test</em></p>
</div>
</div>

The parser is set to regular like suggested here: https://github.com/getgrav/grav-plugin-shortcode-core/issues/67#issuecomment-506149407

schliflo avatar Mar 21 '22 16:03 schliflo

@schliflo dont need |raw anymore with |markdown

ricardo118 avatar Mar 29 '22 14:03 ricardo118

does this work

{% set md = object.markdown|shortcodes|markdown %}

{{ md|markdown }}

ricardo118 avatar Mar 29 '22 14:03 ricardo118

does this work

{% set md = object.markdown|shortcodes|markdown %}

{{ md|markdown }}

Unfortunately this does not work. I think the shortcode handling gets messed up before that. The rendered result still lokks like in the example above. It has a stray closing shortcode tag and the div is closed too early as well.

schliflo avatar Mar 29 '22 15:03 schliflo

Change the parser to regular.

rhukster avatar Mar 29 '22 15:03 rhukster

Change the parser to regular.

The parser is already set to regular, thats the strange thing. It works fine when using the exact same nested shorcode in the page content, just the flex content is bahiving this way

schliflo avatar Mar 29 '22 15:03 schliflo