Preserve custom link attributes in Writer field

If I add a link with custom attributes in a Writer field, the attributes get stripped when updating the content file via panel.

<a href="#" aria-label="View cookie settings" data-cc="c-settings">Settings</a>

becomes

<a href="#" rel="noopener noreferrer">Settings</a>

What would be the best solution/workaround to preserving the data?

Thank you!

FWIW: More specifically I’m referring to a text block

That’s not possible out of the box. You could replace these links on a global basis, but you won’t be using the same attributes for all links, so this wouldn’t make sense.

This plugin allows you to add custom marks, maybe it can serve as a blueprint for creating your own link mark: GitHub - rasteiner/oh-hi-mark: Enables the inclusion of custom Writer field marks

Apart from that, maybe add a feature request on https://feedback.getkirby.com, I think this could be useful for many people.