Skip to content

Commit

Permalink
perf: website announcement support the markdown syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
XPoet committed Nov 27, 2023
1 parent 257962e commit 7189ead
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion layout/home-content.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<% if (theme?.home?.announcement) { %>
<div class="website-announcement border-box">
<i class="icon left fa-solid fa-bullhorn"></i>
<span class="announcement border-box text-ellipsis"><%= theme?.home?.announcement %></span>
<div class="announcement border-box text-ellipsis">
<%- markdown(theme?.home?.announcement) %>
</div>
<i class="icon right close fa-solid fa-close"></i>
</div>
<% } %>
Expand Down
1 change: 0 additions & 1 deletion scripts/filters/link-handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down
11 changes: 10 additions & 1 deletion source/css/layout/home-content.styl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
margin-top -0.4rem
}


+keep-mobile() {
margin-top -0.2rem

Expand All @@ -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
}
}


Expand Down

0 comments on commit 7189ead

Please sign in to comment.