# Giving panel users indentation control in a textarea

**URL:** <https://forum.getkirby.com/t/giving-panel-users-indentation-control-in-a-textarea/5270>\
**Category:** Questions\
**Tags:** v2\
**Created:** [September 16, 2016, 6:32am UTC](https://forum.getkirby.com/t/giving-panel-users-indentation-control-in-a-textarea/5270 "2016-09-16T06:32:10Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonxciv](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simonxciv/32/1456_2.png) [@simonxciv](https://forum.getkirby.com/u/simonxciv)\
**Post date:** [September 16, 2016, 6:32am UTC](https://forum.getkirby.com/t/giving-panel-users-indentation-control-in-a-textarea/5270/1 "2016-09-16T06:32:10Z")

</div>

Hi again everyone,

Hopefully a straightforward question, but perhaps not. For a site I’m working on at the moment, I’d like to be able to give users the ability to control the indentation inside a textarea field by entering spaces preceding lines of text. Currently, doing so would change the text to a code block. Is there any way to change this behaviour so the kirbytext processor turns each space preceding text on a new line into `&nbsp;` characters?

Thanks in advance for any help or ideas 🙂

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [September 16, 2016, 6:56am UTC](https://forum.getkirby.com/t/giving-panel-users-indentation-control-in-a-textarea/5270/2 "2016-09-16T06:56:50Z")

</div>

What is your use case for this?

---

<div class="post-metadata">

**Author:** ![simonxciv](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simonxciv/32/1456_2.png) [@simonxciv](https://forum.getkirby.com/u/simonxciv)\
**Post date:** [September 16, 2016, 7:18am UTC](https://forum.getkirby.com/t/giving-panel-users-indentation-control-in-a-textarea/5270/3 "2016-09-16T07:18:37Z")

</div>

It’s an odd use case, but my users will be posting poetry that requires some quirky line indents. None of them are technical enough to know about adding classes to `<P>` tags for example, which is a solution I’d considered too.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [September 16, 2016, 7:23am UTC](https://forum.getkirby.com/t/giving-panel-users-indentation-control-in-a-textarea/5270/4 "2016-09-16T07:23:43Z")

</div>

You could probably use a kirbytext pre filter: [https://getkirby.com/docs/developer-guide/kirbytext/filters](https://getkirby.com/docs/developer-guide/kirbytext/filters) to prevent the default markdown behaviour and convert those spaces to `&nbsp;` characters, maybe this is possible with some regex voodoo.

---

<div class="post-metadata">

**Author:** ![simonxciv](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simonxciv/32/1456_2.png) [@simonxciv](https://forum.getkirby.com/u/simonxciv)\
**Post date:** [September 16, 2016, 8:04am UTC](https://forum.getkirby.com/t/giving-panel-users-indentation-control-in-a-textarea/5270/5 "2016-09-16T08:04:33Z")

</div>

Thanks for the link, I’ll check it out shortly 🙂

> [@texnixe](#):
>
> regex voodoo

Those are two words that genuinely terrify me! Haha

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [September 16, 2016, 8:07am UTC](https://forum.getkirby.com/t/giving-panel-users-indentation-control-in-a-textarea/5270/6 "2016-09-16T08:07:13Z")

</div>

Is there a pattern regarding the spaces? Are they only at the beginning of a line after a new line?

---

<div class="post-metadata">

**Author:** ![simonxciv](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simonxciv/32/1456_2.png) [@simonxciv](https://forum.getkirby.com/u/simonxciv)\
**Post date:** [September 16, 2016, 8:10am UTC](https://forum.getkirby.com/t/giving-panel-users-indentation-control-in-a-textarea/5270/7 "2016-09-16T08:10:02Z")

</div>

They will often be at the start of a new line inside a paragraph (after a `<br>`), or sometimes the beginning of a paragraph.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [September 16, 2016, 8:14am UTC](https://forum.getkirby.com/t/giving-panel-users-indentation-control-in-a-textarea/5270/8 "2016-09-16T08:14:02Z")

</div>

Maybe it would be easier to use a kirbytag?

```auto
(spaces: 4) some text
some more text
(spaces: 2) and so on

```

---

<div class="post-metadata">

**Author:** ![simonxciv](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simonxciv/32/1456_2.png) [@simonxciv](https://forum.getkirby.com/u/simonxciv)\
**Post date:** [September 16, 2016, 8:17am UTC](https://forum.getkirby.com/t/giving-panel-users-indentation-control-in-a-textarea/5270/9 "2016-09-16T08:17:54Z")

</div>

This seems like a great idea! Why hadn’t I thought of doing it that way?

Thanks for your help, I’ll see how I go!

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [September 16, 2016, 9:06am UTC](https://forum.getkirby.com/t/giving-panel-users-indentation-control-in-a-textarea/5270/10 "2016-09-16T09:06:21Z")

</div>

That Kirbytag could then also use a class with a left padding/margin instead of inserting spaces directly. Spaces are not very semantic as they are only used for presentation purposes in your use-case, so using CSS would make more sense.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [September 16, 2016, 9:17am UTC](https://forum.getkirby.com/t/giving-panel-users-indentation-control-in-a-textarea/5270/11 "2016-09-16T09:17:39Z")

</div>

Also may also want to check out this article: [http://www.vianegativa.us/2010/06/how-to-format-poetry-on-the-web-an-incomplete-guide/#css](http://www.vianegativa.us/2010/06/how-to-format-poetry-on-the-web-an-incomplete-guide/#css)

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 4:55pm UTC](https://forum.getkirby.com/t/giving-panel-users-indentation-control-in-a-textarea/5270/12 "2025-02-06T16:55:15Z")

</div>

Archived on February 6, 2025, 4:55pm UTC


