From 78a6a19d8d14e7e7993c1740d520e63cbfaa21dd Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 17 Nov 2022 21:01:52 -0500 Subject: [PATCH] Add inline markdown rendering for post titles. Fixes #827 (#860) --- src/shared/components/post/post-listing.tsx | 5 +++-- src/shared/utils.ts | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index c14ea2f..7a8bdb6 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -42,6 +42,7 @@ import { isVideo, md, mdToHtml, + mdToHtmlInline, numToSI, relTags, setupTippy, @@ -459,7 +460,7 @@ export class PostListing extends Component { title={url} rel={relTags} > - {post.name} +
), none: ( @@ -468,7 +469,7 @@ export class PostListing extends Component { to={`/post/${post.id}`} title={i18n.t("comments")} > - {post.name} +
), })} diff --git a/src/shared/utils.ts b/src/shared/utils.ts index 6494a7d..23acfe5 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -167,6 +167,10 @@ export function mdToHtml(text: string) { return { __html: md.render(text) }; } +export function mdToHtmlInline(text: string) { + return { __html: md.renderInline(text) }; +} + export function getUnixTime(text: string): number { return text ? new Date(text).getTime() / 1000 : undefined; } -- 2.44.1