Writer field ->inline() outputs anchor tags

Hello, I am on 4.5

I assumed that using ->inline() on a writer field would effectively strip all html tags.

I am trying to output the content of a writer field without any html tags to a data attribute, but this particular field has a link, and this link is rendered with its <a> tags, which breaks my code.

Thank you

The a tag is an element that can be used perfectly fine inline, which is why it is kept (inline doesn’t mean stripping all tags): kirby/src/Toolkit/Html.php at main · getkirby/kirby · GitHub

You could use the $field->excerpt() | Kirby CMS

Or you could create your own custom field method that strips all tags fully: kirby/config/methods.php at main · getkirby/kirby · GitHub