Extend the textarea-field to include option to indent text?

I am using Kirby Enhanced Textarea v1.7 in order to give my textarea field more editing capabilities.

I would like to include the option to indent a line of text. How might this be done?

Essentially, I want to be able to generate text content looking like this by only using the textarea-field:

35

The image is missing?

After a quick google I don’t think there is a way to do this with markdown. The Enhanced Textarea can be added on to but you need to tell it what to do and there is no indent in Markdown.

Its a list of photographers, so I would use the markdown to make those names a list and use CSS to indent them.

@texnixe I can see the image

Ok, I can see it now as well, for some reason, images were disabled in my browser.

The current enhanced textarea field already has a list option. However, in your particular case, you probably need a list with an extra class which could be achieved with a Kirbytagwhich you would then have to add as an extra option to the textarea buttons. But first, you need the tag.

@texnixe

Thanks for pointing me in the direction of kirbytags :slight_smile:

Could you give me a brief rundown of how they work? From the doc I’m getting a basic understanding of their structure but I’m having difficulties understanding how to actually use them, specifically if I want to use a tag to extend the existing Enhanced Textarea-Plugin.

For a list I would actually not use a real kirbytag, but some code that you can open and close, for example:

(list: class: indented)
- item 1
- item 2
(…list)

or custom html tags

<list class: indented>
- item 1
- item 2
</list>

Both of these possibilities then use a Kirbytext filter. An example for the latter can be found on the getirby.com website: https://github.com/getkirby/getkirby.com/blob/master/site/plugins/since/since.php

The first one works the same way, only with a different style of tags, example: https://github.com/getkirby-plugins/columns-plugin

As regards integration into the Enhanced textarea field, I’d suggest you have a look at the source code.

I think you would have to copy one of the built in ones and tweak it. For instance if you look at the Email button lines 32 - 38 it has a kirby text tag in there that gets used. I would copy this file, call it indent.php and then tweak it to use your kirbytag. You need a corresponding form as well by the looks of it.

Another question is how you would like the button to behave. Do you want it to just insert the tags and the user fills the list in between maybe, even using the list button (the latter option sounds like a strange workflow)? Or do you need a modal where the user fills the list?

The easiest way to achieve what you have in mind without any coding required: Enable Markdown Extra, use a heading with a class and then style the list immediately following that heading.

## Photography {.indented}

- Lucha Fuchs
- Matthias Koslik
- Julia Reimann

https://michelf.ca/projects/php-markdown/extra/#spe-attr