From 7189ead987bb070077ad4c22881c943ea028a0ce Mon Sep 17 00:00:00 2001 From: XPoet Date: Mon, 27 Nov 2023 14:04:21 +0800 Subject: [PATCH] perf: website announcement support the markdown syntax --- layout/home-content.ejs | 4 +++- scripts/filters/link-handle.js | 1 - source/css/layout/home-content.styl | 11 ++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/layout/home-content.ejs b/layout/home-content.ejs index 6fc01389f..b2529de16 100644 --- a/layout/home-content.ejs +++ b/layout/home-content.ejs @@ -2,7 +2,9 @@ <% if (theme?.home?.announcement) { %>
- <%= theme?.home?.announcement %> +
+ <%- markdown(theme?.home?.announcement) %> +
<% } %> diff --git a/scripts/filters/link-handle.js b/scripts/filters/link-handle.js index 8bc18aace..89f389115 100644 --- a/scripts/filters/link-handle.js +++ b/scripts/filters/link-handle.js @@ -15,7 +15,6 @@ hexo.extend.filter.register( data.content = data.content.replace( regPureATag, function (match, attrBegin, href, attrEnd, html) { - // Exit if the href attribute doesn't exists. if (!href) return match let link = '' diff --git a/source/css/layout/home-content.styl b/source/css/layout/home-content.styl index 81b173bf0..df562f9d1 100644 --- a/source/css/layout/home-content.styl +++ b/source/css/layout/home-content.styl @@ -13,6 +13,7 @@ margin-top -0.4rem } + +keep-mobile() { margin-top -0.2rem @@ -25,10 +26,18 @@ } } + .announcement { width 100% - padding 0 0.4rem + padding 0 0.5rem color var(--text-color-3) + + p { + width 100% + overflow hidden + white-space nowrap + text-overflow ellipsis + } }