Problem rendering a link from the textarea Fields

When inserting text and creating a link within the text using the editor button, a code snippet is created which is used to render the link.

Unfortunately the link tag is not rendered correctly in the frontend. A link tag is created within a link tag. Where is the error? Would be grateful for any help.

Kirby Version: 3.6.6

Text editor content:

(link: https://google.com text: Lorem ipsum dolor sit amet)

Output in frontend:

<a href="https://google.com">Lorem ipsum dolor sit amet</a>

Source code in frontend:

<p><a href="<a href="https://google.com">Lorem">https://google.com">Lorem</a> ipsum dolor sit amet</a></p>

Template content:

<?= $page->inhalt()->kt() ?>

Hey, welcome to the forum!

I’m missing a bit of context:

What is $block in this context?

Could you post the blueprint for that page, please?

My mistake I have corrected my post

my home.yml

    columns:
      main:
        width: 2/3
        fields:
          headline:
            label: Überschrift
            type: text
          inhalt:
            label: Inhalt
            type: textarea
            buttons:
              - bold
              - italic
              - '|'
              - link
            size: medium

Hm, what is actually stored in your home.txt?

my home.txt

Title: Home

----

Headline: Lorem ipsum dolor sit amet

----

Inhalt: (link: https://google.com text: Lorem ipsum dolor sit amet)

I cannot reproduce this issue, I’m afraid.

Are you really just outputting

<?= $page->inhalt()->kt() ?>

In the template? Or is that maybe inside some other code?

Make sure you don’t have an opening link somewhere before you use render the link.

home.php

<?php snippet('header') ?>
<?php snippet('home/infobox') ?>
<?php snippet('home/kacheln') ?>
<?php snippet('home/partners') ?>
<?php snippet('footer') ?>

home/infobox.php

<div class="uk-section-xsmall">
  <div class="uk-container uk-container-expand">
    <div class="uk-card uk-card-default uk-card-body">
      <h3 style="color:red;font-weight:bold"><?= $page->headline() ?></h3>

      <div class="uk-grid-match" data-uk-grid>
        <div class="uk-width-expand@m">
          <?= $page->inhalt()->kt() ?>
          <?/*= kt($page->inhalt()) */?>
        </div>
        <div class="uk-width-1-3@m">
          <?= $page->bild()->toBlocks() ?>
        </div>
      </div>
      <div>

      </div>
    </div>
  </div>
</div>

now i tried my home.php like this:

<?php snippet('home/infobox') ?>

home/infobox.php

<div class="uk-section-xsmall">
  <div class="uk-container uk-container-expand">
    <div class="uk-card uk-card-default uk-card-body">
      <h3 style="color:red;font-weight:bold"><?= $page->headline() ?></h3>

      <div class="uk-grid-match" data-uk-grid>
        <div class="uk-width-expand@m">
          <?= $page->inhalt()->kt() ?>
          <?/*= kt($page->inhalt()) */?>
        </div>
        <div class="uk-width-1-3@m">
          <?= $page->bild()->toBlocks() ?>
        </div>
      </div>
      <div>

      </div>
    </div>
  </div>
</div>

result in browser:

<div class="uk-section-xsmall">
  <div class="uk-container uk-container-expand">
    <div class="uk-card uk-card-default uk-card-body">
      <h3 style="color:red;font-weight:bold">Lorem ipsum dolor sit amet</h3>

      <div class="uk-grid-match" data-uk-grid>
        <div class="uk-width-expand@m">
          <p>&lt;a href="<a href="https://google.com&quot;&gt;Lorem">https://google.com"&gt;Lorem</a> ipsum dolor sit amet&lt;/a&gt;</p>                  </div>
        <div class="uk-width-1-3@m">
          <figure data-ratio="4/3">
    <img src="https://google.com/uploads/lorem.webp" alt="Lorem ipsum dolor sit amet">
  
  </figure>
        </div>
      </div>
      <div>

      </div>
    </div>
  </div>
</div>

I wonder if your text contains any hidden characters?

Or have you installed any plugins? Which ones?

no plugins in use at the moment

hidden Characters?

maybe a conflict between js files?

I can’t tell what’s causing this, but you seem to have some code somewhere that interferes, this is not something caused by Kirby, I think, at least nothing that I can reproduce.

fresh installed Kirby 3.6.6 plain under: http://kirby.wamb-office.de/

site/config/config.php

<?php

return [
    'debug'  => true,
    'url' => 'http://kirby.wamb-office.de',
    'locale' => 'de_DE.utf-8',
    'date'  => [
        'handler' => 'strftime'
    ],
    'slugs' => 'de',
    'slugs.maxlength' => 320,
    'thumbs' => [
        'srcsets' => [
            'default' => [
                '800w' => ['width' => 800, 'quality' => 80],
                '1024w' => ['width' => 1024, 'quality' => 80],
                '1440w' => ['width' => 1440, 'quality' => 80],
                '2048w' => ['width' => 2048, 'quality' => 80]
            ]
        ],
        'format' => 'webp',
        'driver' => 'gd'
    ],
    'auth' => [
        'trials' => 5
    ],
    'email' => [
        'presets' => [
            'contact' => [
                'from'    => 'no-reply@supercompany.com',
                'subject' => 'Thank you for your contact request',
                'cc'      => 'marketing@supercompany.com',
                'body'    => 'We will never reply'
            ]
        ],
        'transport' => [
            'type' => 'smtp',
            'host' => 'smtp.strato.de',
            'port' => 465,
            'security' => true,
            'auth' => true,
            'username' => '...',
            'password' => '...',
        ]
    ],
    'markdown' => [
        'extra' => true,
        'safe' => true
    ],
    'panel' =>[
        'install' => true,
        'slug' => 'manage',
        'language' => 'de'
    ],
    'hooks' => [

    ]
];

site/templates/default.php

<h1><?= $page->title() ?></h1>
<div><?= $page->text() ?></div>
<div><?= $page->text()->kirbytext() ?></div>

content/1_home/home.txt

Title: Home

----

Text: (link: https://google.de text: Lorem Ipsum)

i found the issue:
site/config/config.php

'markdown' => [
        'extra' => true,
        'safe' => true
    ],

if safe is true it will appears this issue, set it to false all is working…

Interesting. Must admit I never used that setting and missed it in your config above.

Glad you found the issue. To me that looks as if this setting should not be used in conjunction with Kirbytext, works fine if you use Markdown syntax ([Lorem ipsum](https://google.de)).

Edit: I also tested other tags like (image:) which don’t work with this setting either.

However, it brings conflicts if you use the textarea and markdown fields and have configured them appropriately.