From: Dessalines Date: Fri, 18 Nov 2022 02:01:52 +0000 (-0500) Subject: Add inline markdown rendering for post titles. Fixes #827 (#860) X-Git-Url: http://these/git/%22https:/nerdica.net/%7Bpost.creator_id.toString%28%29%7D?a=commitdiff_plain;h=78a6a19d8d14e7e7993c1740d520e63cbfaa21dd;p=lemmy-ui.git Add inline markdown rendering for post titles. Fixes #827 (#860) --- 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; }