Shortcode arguments not parsed


I’m trying to add a shortcode to my GIS plugin but I’m facing the same issue as this one : Override parser · Issue #24 · getgrav/grav-plugin-shortcode-core · GitHub

In my case, it’s not because of the Smartypants plugin but because of my Better Typography plugin.

Using the Regex setting in Shortcode Core solves the issue… But instead of using

$this->grav['config']->set('plugins.shortcode-core.parser', 'regex');

I’d prefer solves the issue within the Better Typography plugin. I suspect it’s because I call onPageContentProcessed (grav-plugin-better-typography/better-typography.php at main - grav-plugin-better-typography - vous délivre votre code) and it happens before the Shortcode Core : grav-plugin-shortcode-core/shortcode-core.php at develop · getgrav/grav-plugin-shortcode-core · GitHub

So, I just need to change the priority like this ?

'onPageContentProcessed' => ['onPageContentProcessed', -20],

Thanks !

[EDIT]Changing the priority doesn’t seem to work, BetterTypography is applied before ShortcodeCore[/EDIT]

You need to define it in plugin blueprint

Edit: Hmm… It looks like it’s a separate priorities.yaml :thinking: Actually not sure how to define it from the plugin side, so maybe your approach is the way

Edit2: That page says priorities are defined in onPluginsInitialized(), but can’t see it in the docs, so checked shortcode-core and it has priority of 10

['onPluginsInitialized', 10]

So yours should be < 10

It seems I had a cache issue or something like that… It seems to work now, using

['onPluginsInitialized', 0]

and then

'onPageContentProcessed' => ['onPageContentProcessed', -20],

Sorry for the noise ! I’ll come back later if the problem reappears.


  • What behaviour of the shortcode tells you you have a problem?
    What happened and what did you expect to happen?

  • What made you conclude that 'onPageContentProcessed' => ['onPageContentProcessed', -20], solved the issue?

  • The following doesn’t make sense to me:

    But instead of using
    $this->grav['config']->set('plugins.shortcode-core.parser', 'regex');
    I’d prefer solves the issue within the Better Typography plugin.

    “Instead of using [code snippet]”
    So you don’t want to use the [code snippet]? But that is the proposed solution in the Github issue, isn’t it?

    “I’d prefer solves the issue within the Better Typography plugin.”
    Doesn’t the [code snippet run inside your plugin?
    What other solution would you prefer?

Hi @pamtbaau !

  1. I spotted the issue while adding parameters to the shortcode : [gis /] was well parsed while [gis height=320 /] wasn’t and appeared as if, as content.
    If I had quotes in my shortcode arguments ([gis id="test d'id" /]), they were modified into french quotes…
    That’s what guided me into considering that the BetterTypography parses markdown content before the Shortcore Core plugin.

  2. Modifying the priority of the onPageContentProcessed appears to solve the issue : quotes are no more modified into french quotes, and shortcodes are well parsed.

  3. i don’t see why a plugin should modify the settings of another one ; what if another plugin doesn’t need the same setting ? And, deep down, the issue isn’t one of the GIS plugin I’ve been working on but one of the BetterTypography in which content parsing should be applied after every other treatments.

@bricebou, Ah, that added the context and clarity I needed… Yes I know, I’m just bad at mindreading and filling in the blanks.

Sorry, my bad :slight_smile:

Thanks again !