Change default textarea buttons from Kirbytext to simple Markdown?

Hi everyone!

I am working on a small project that uses Kirby as back end, serving data as JSON to a frontend application. I use Markdown-it to parse the JSON output and turn content back into HTML. My only issue is that Markdown-it doesn’t support Kirbytext.

Is there a simple way to change the default text area buttons of Link and Email links so they create content in Markdown rather than Kirbytext?

I want my text fields to contain links in the following format

[Something here](http://www.somethinghere.com)
[Email](mailto:address@email.com)

Sorry if this is a very simple question but I haven’t found any clear indication on this.

Thank you!

You would have to create a custom textarea field. Otherwise, there is no option to disable Kirbytext and use markdown instead.

This is the bit where the template for the email tag is defined:

var tag;
      if(form.data('kirbytext')) {
        if(text.length) {
          tag = '(email: ' + address + ' text: ' + text + ')';
        } else {
          tag = '(email: ' + address + ')';
        }
      } else {
        if(text.length) {
          tag = '[' + text + '](mailto:' + address + ')';
        } else {
          tag = '<' + address + '>';
        }
      }

in panel/app/field/textarea/views/email.php

So you could make a copy of this field, save it in /site/fields and change what each view inserts into the textarea field.

1 Like

Thank you. It worked like a charm.

May be, you can use:
panel.kirbytext

1 Like

@anon77445132 Thanks, I knew that featured used to be there but somehow was too blind to see it when I was looking for it…

This should come up when one searches for it…Thanks a lot.

Yep, search could be improved. It’s already much better than it used to be, but still…