Details
-
Task
-
Resolution: Unresolved
-
P3: Somewhat important
-
dev
-
None
Description
Escaping HTML input might come in handy for adding custom formatting to a rich text label.
In KDE we often find ourselves reimplementing and copy-pasting basic variant of `sanitize` function, hoping that it would be enough for QtQuick/Text parser. Of course, doing in it JavaScript, like constructing a mapping table or regex of every call isn't very efficient, let alone dealing code duplication in the long term.
How about exposing Qt Core method QString::toHtmlEscaped as a global Qt.toHtmlEscaped function?
It would be a nice addition to the supported standard global functions encodeURI, decodeURIComponent, … family.
If there are no objections, I could give a shot, and send a patch with tests later.
For the context: https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1716