Skip to content

Commit 7189ead

Browse files
committedNov 27, 2023
perf: website announcement support the markdown syntax
1 parent 257962e commit 7189ead

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed
 

‎layout/home-content.ejs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<% if (theme?.home?.announcement) { %>
33
<div class="website-announcement border-box">
44
<i class="icon left fa-solid fa-bullhorn"></i>
5-
<span class="announcement border-box text-ellipsis"><%= theme?.home?.announcement %></span>
5+
<div class="announcement border-box text-ellipsis">
6+
<%- markdown(theme?.home?.announcement) %>
7+
</div>
68
<i class="icon right close fa-solid fa-close"></i>
79
</div>
810
<% } %>

‎scripts/filters/link-handle.js

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ hexo.extend.filter.register(
1515
data.content = data.content.replace(
1616
regPureATag,
1717
function (match, attrBegin, href, attrEnd, html) {
18-
// Exit if the href attribute doesn't exists.
1918
if (!href) return match
2019

2120
let link = ''

‎source/css/layout/home-content.styl

+10-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
margin-top -0.4rem
1414
}
1515

16+
1617
+keep-mobile() {
1718
margin-top -0.2rem
1819

@@ -25,10 +26,18 @@
2526
}
2627
}
2728

29+
2830
.announcement {
2931
width 100%
30-
padding 0 0.4rem
32+
padding 0 0.5rem
3133
color var(--text-color-3)
34+
35+
p {
36+
width 100%
37+
overflow hidden
38+
white-space nowrap
39+
text-overflow ellipsis
40+
}
3241
}
3342

3443

0 commit comments

Comments
 (0)