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

Support s tags for strikethrough for Matrix v1.10 #12604

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/HtmlUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ const topicSanitizeHtmlParams: IExtendedSanitizeOptions = {
allowedTags: [
"font", // custom to matrix for IRC-style font coloring
"del", // for markdown
"s",
"a",
"sup",
"sub",
Expand Down
2 changes: 2 additions & 0 deletions src/Linkify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ export const transformTags: NonNullable<IExtendedSanitizeOptions["transformTags"

export const sanitizeHtmlParams: IExtendedSanitizeOptions = {
allowedTags: [
// These tags are suggested by the spec https://spec.matrix.org/v1.10/client-server-api/#mroommessage-msgtypes
"font", // custom to matrix for IRC-style font coloring
t3chguy marked this conversation as resolved.
Show resolved Hide resolved
"del", // for markdown
"s",
"h1",
"h2",
"h3",
Expand Down
2 changes: 1 addition & 1 deletion src/Markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { logger } from "matrix-js-sdk/src/logger";

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

const ALLOWED_HTML_TAGS = ["sub", "sup", "del", "u", "br", "br/"];
const ALLOWED_HTML_TAGS = ["sub", "sup", "del", "s", "u", "br", "br/"];

// These types of node are definitely text
const TEXT_NODES = ["text", "softbreak", "linebreak", "paragraph", "document"];
Expand Down
2 changes: 2 additions & 0 deletions src/editor/deserialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ function parseNode(n: Node, pc: PartCreator, opts: IParseOptions, mkListItem?: (
return [pc.plain("**"), ...parseChildren(n, pc, opts), pc.plain("**")];
case "DEL":
return [pc.plain("<del>"), ...parseChildren(n, pc, opts), pc.plain("</del>")];
case "S":
return [pc.plain("<s>"), ...parseChildren(n, pc, opts), pc.plain("</s>")];
t3chguy marked this conversation as resolved.
Show resolved Hide resolved
case "SUB":
return [pc.plain("<sub>"), ...parseChildren(n, pc, opts), pc.plain("</sub>")];
case "SUP":
Expand Down
Loading