From c4f73445641dbcb2580e8c9bcecd30a329ca3ef2 Mon Sep 17 00:00:00 2001 From: cmp Date: Tue, 29 Aug 2023 22:39:39 -0500 Subject: [PATCH 1/3] Ensure markdown links have the noopener and nofollow rel tags as well. (#2100) --- src/shared/markdown.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/shared/markdown.ts b/src/shared/markdown.ts index 97568b51..65ff3404 100644 --- a/src/shared/markdown.ts +++ b/src/shared/markdown.ts @@ -15,7 +15,7 @@ import markdown_it_sub from "markdown-it-sub"; import markdown_it_sup from "markdown-it-sup"; import Renderer from "markdown-it/lib/renderer"; import Token from "markdown-it/lib/token"; -import { instanceLinkRegex } from "./config"; +import { instanceLinkRegex, relTags } from "./config"; export let Tribute: any; @@ -185,7 +185,7 @@ export function setupMarkdown() { // defs: emojiDefs, // }) .disable("image"); - const defaultRenderer = md.renderer.rules.image; + const defaultImageRenderer = md.renderer.rules.image; md.renderer.rules.image = function ( tokens: Token[], idx: number, @@ -205,7 +205,7 @@ export function setupMarkdown() { const isLocalEmoji = customEmoji !== undefined; if (!isLocalEmoji) { const imgElement = - defaultRenderer?.(tokens, idx, options, env, self) ?? ""; + defaultImageRenderer?.(tokens, idx, options, env, self) ?? ""; if (imgElement) { return `'; }; + const defaultLinkRenderer = + md.renderer.rules.link_open || + function (tokens, idx, options, _env, self) { + return self.renderToken(tokens, idx, options); + }; + md.renderer.rules.link_open = function ( + tokens: Token[], + idx: number, + options: MarkdownIt.Options, + env: any, + self: Renderer, + ) { + tokens[idx].attrPush(["rel", relTags]); + return defaultLinkRenderer(tokens, idx, options, env, self); + }; } export function setupEmojiDataModel(custom_emoji_views: CustomEmojiView[]) { From b2927c36a21f647bcd4d8fb5fd49e6a43f5cf4bc Mon Sep 17 00:00:00 2001 From: cmp Date: Wed, 30 Aug 2023 11:42:30 -0500 Subject: [PATCH 2/3] Update spoiler icon to diamond shape. (#2102) --- src/assets/symbols.svg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/symbols.svg b/src/assets/symbols.svg index 6e9c6ef9..dba5dbe6 100644 --- a/src/assets/symbols.svg +++ b/src/assets/symbols.svg @@ -142,8 +142,8 @@ - - + + From 6224c4e378aa5ed9a10aa4f0c06095b8df95fc7d Mon Sep 17 00:00:00 2001 From: Die4Ever <30947252+Die4Ever@users.noreply.github.com> Date: Wed, 30 Aug 2023 13:52:36 -0500 Subject: [PATCH 3/3] always show community name with instance for easy copy-pasting to friends (#2073) * always show community name with instance for easy copy-pasting to friends I don't like the inconsistency of community names currently, the UI shouldn't be presenting things differently because of technical reasons that are hard for users to understand. This makes it easier to share communities with your friends! * always show community name with instance, cleanup --- src/shared/components/community/community-link.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/shared/components/community/community-link.tsx b/src/shared/components/community/community-link.tsx index 83194caa..23cdc73c 100644 --- a/src/shared/components/community/community-link.tsx +++ b/src/shared/components/community/community-link.tsx @@ -21,20 +21,19 @@ export class CommunityLink extends Component { render() { const community = this.props.community; - let name_: string, title: string, link: string; + let title: string, link: string; const local = community.local === null ? true : community.local; + const domain = hostname(community.actor_id); if (local) { - name_ = community.name; title = community.title; link = `/c/${community.name}`; } else { - const domain = hostname(community.actor_id); - name_ = `${community.name}@${domain}`; + const name_ = `${community.name}@${domain}`; title = `${community.title}@${domain}`; link = !this.props.realLink ? `/c/${name_}` : community.actor_id; } - const apubName = `!${name_}`; + const apubName = `!${community.name}@${domain}`; const displayName = this.props.useApubName ? apubName : title; return !this.props.realLink ? (