Escaping HTML input might come in handy for adding custom formatting to a rich text label.
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