Tag conversion without kirbytext

Hey,

is there a way to convert a custom kirbytag of a text field without using the kirbytext/markdown method? I would like to avoid the p tags that would otherwise be added to my text.

As pointed out in Is it possibble to parse kirbytext tags without markdown? one way would be to disable makedown in the config. However this would not work for me because I still need markdown conversion on other texts.

Thanks,
Tim

You can use a function that filters them out:

function ktRaw($content) {
  $text = kirbytext($content);
  return preg_replace('/(.*)<\/p>/', '$1', preg_replace('/<p>(.*)/', '$1', $text));
}

If you only need one Kirbytag per field, you could also use the kirbytag() helper.

Hey all together!

I created the custom field method $field->convertKirbytags() that gives me what I need. You can find it on github.