Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 21ae29c

Browse files
authored
Support s tags for strikethrough for Matrix v1.10 (#12604)
* Support s tags for strikethrough for Matrix v1.10 Signed-off-by: Michael Telatynski <[email protected]> * iterate Signed-off-by: Michael Telatynski <[email protected]> * Update src/Linkify.tsx --------- Signed-off-by: Michael Telatynski <[email protected]>
1 parent ccf751d commit 21ae29c

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

src/HtmlUtils.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ const topicSanitizeHtmlParams: IExtendedSanitizeOptions = {
124124
allowedTags: [
125125
"font", // custom to matrix for IRC-style font coloring
126126
"del", // for markdown
127+
"s",
127128
"a",
128129
"sup",
129130
"sub",

src/Linkify.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,10 @@ export const transformTags: NonNullable<IExtendedSanitizeOptions["transformTags"
147147

148148
export const sanitizeHtmlParams: IExtendedSanitizeOptions = {
149149
allowedTags: [
150+
// These tags are suggested by the spec https://spec.matrix.org/v1.10/client-server-api/#mroommessage-msgtypes
150151
"font", // custom to matrix for IRC-style font coloring
151152
"del", // for markdown
153+
"s",
152154
"h1",
153155
"h2",
154156
"h3",

src/Markdown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { logger } from "matrix-js-sdk/src/logger";
2222

2323
import { linkify } from "./linkify-matrix";
2424

25-
const ALLOWED_HTML_TAGS = ["sub", "sup", "del", "u", "br", "br/"];
25+
const ALLOWED_HTML_TAGS = ["sub", "sup", "del", "s", "u", "br", "br/"];
2626

2727
// These types of node are definitely text
2828
const TEXT_NODES = ["text", "softbreak", "linebreak", "paragraph", "document"];

src/editor/deserialize.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ function parseNode(n: Node, pc: PartCreator, opts: IParseOptions, mkListItem?: (
195195
return [pc.plain("**"), ...parseChildren(n, pc, opts), pc.plain("**")];
196196
case "DEL":
197197
return [pc.plain("<del>"), ...parseChildren(n, pc, opts), pc.plain("</del>")];
198+
case "S":
199+
return [pc.plain("<s>"), ...parseChildren(n, pc, opts), pc.plain("</s>")];
198200
case "SUB":
199201
return [pc.plain("<sub>"), ...parseChildren(n, pc, opts), pc.plain("</sub>")];
200202
case "SUP":

0 commit comments

Comments
 (0)