getkirby-v2 / toolkit

This is the deprecated toolkit for Kirby v2.

Home Page:http://getkirby.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

validate minLength/maxLength: exclude markdown-syntax from count

raschid opened this issue · comments

commented

I want to suggest, that the blueprint minLength/maxLength-Validtor is rewritten in a way so that counted characters reflect the written content only, not content plus markdown.

For editors, texters or copiers it is pretty inconvenient not to be able to rely on the displayed character-count , because it might include more or less heavy styling.

I think this could get pretty complicated. You would have to exclude Markdown, but also Kirbytext (but only the parts that are not part of the text) and HTML in Markdown. 🤔

I agree with @texnixe. Excluding formatting from the counter only works by parsing the Markdown and then stripping all markup from the resulting HTML. But that is not only not very good for performance, it is also a behavior not everyone expects (the length validators are intended to count actual length in characters, not "content length").

@raschid What is your use-case for this? What kind of content are the editors supposed to put into the field? What is the use-case for the length validators? And with which field (text or textarea) do you use this?