Add custom syntax for tagging spoilers

Currently the only two ways to spoiler text in your message is either:
* Using the /spoiler command
* Manually typing the data-mx-spoiler span HTML blocks

Neither one is discoverable, or friendly to users really. Instead, we
should extend our existing Markdown-based formatting syntax with one
that can handle spoiler tags. I chose the || syntax to match Discord,
since Element doesn't seem to adopt one.

Unfortunately, CMark does not support custom extensions (see
https://github.com/commonmark/cmark/pull/123) so we have to implement
our own parsing function. New tests are also added for this too.
This commit is contained in:
Joshua Goins
2025-04-27 17:04:05 -04:00
parent 86a43c4f7e
commit 6b5996a1bd
3 changed files with 50 additions and 0 deletions

View File

@@ -140,6 +140,7 @@ private:
QString escapeHtml(QString stringIn);
QString unescapeHtml(QString stringIn);
QString linkifyUrls(QString stringIn);
QString customMarkdownToHtml(const QString &stringIn);
QString editString() const;
QString emoteString(const NeoChatRoom *room = nullptr, const Quotient::RoomEvent *event = nullptr) const;