Skip to content

Commit

Permalink
Merge pull request #282 from XPoet/dev
Browse files Browse the repository at this point in the history
Release new version
  • Loading branch information
XPoet authored Nov 30, 2023
2 parents 0e10301 + 833f510 commit 084e1c7
Show file tree
Hide file tree
Showing 18 changed files with 268 additions and 234 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ body:
I made sure I checked
我确认我已经检查过了
options:
- label: I am using Keep version `4.0.2` or later. (使用 Keep `4.0.2` 或更高版本)
- label: I am using Keep version `4.0.3` or later. (使用 Keep `4.0.3` 或更高版本)
required: true
- label: I have already read the [Troubleshooting page of Hexo](https://hexo.io/docs/troubleshooting) and [Keep documents](https://keep-docs.xpoet.cn). (已阅读 [Hexo 故障处理页面](https://hexo.io/docs/troubleshooting) 和 [Keep 文档](https://keep-docs.xpoet.cn))
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ body:
I made sure I checked
我确认我已经检查过了
options:
- label: I am using Keep version `4.0.2` or later. (使用 Keep `4.0.2` 或更高版本)
- label: I am using Keep version `4.0.3` or later. (使用 Keep `4.0.3` 或更高版本)
required: true
- label: I have already read the [Troubleshooting page of Hexo](https://hexo.io/docs/troubleshooting) and [Keep documents](https://keep-docs.xpoet.cn). (已阅读 [Hexo 故障处理页面](https://hexo.io/docs/troubleshooting) 和 [Keep 文档](https://keep-docs.xpoet.cn))
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/other.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ body:
I made sure I checked
我确认我已经检查过了
options:
- label: I am using Keep version `4.0.2` or later. (使用 Keep `4.0.2` 或更高版本)
- label: I am using Keep version `4.0.3` or later. (使用 Keep `4.0.3` 或更高版本)
required: true
- label: I have already read the [Troubleshooting page of Hexo](https://hexo.io/docs/troubleshooting) and [Keep documents](https://keep-docs.xpoet.cn). (已阅读 [Hexo 故障处理页面](https://hexo.io/docs/troubleshooting) 和 [Keep 文档](https://keep-docs.xpoet.cn))
required: true
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div align="right">
Language:
English |
<a title="Chinese" href="docs/README_zh-CN.md">简体中文</a> |
<a title="Chinese" href="docs/README_zh-TW.md">繁體中文</a>
<a title="简体中文" href="docs/README_zh-CN.md">简体中文</a> |
<a title="繁體中文" href="docs/README_zh-TW.md">繁體中文</a>
</div>

<a href="https://xpoet.cn"><img align="center" alt="Keep" src="https://keep-docs.xpoet.cn/images/keep-slogan.svg"></a>
Expand All @@ -25,6 +25,14 @@

> If you want to put a link to your blog in the online preview list, you can give the author a PR.
## :books: Documents

Please see the official documents of **Keep**.

- **[Keep official document](https://keep-docs.xpoet.cn/)**
- **[Keep theme configuration guide](https://keep-docs.xpoet.cn/basis/configuration-guide/base_info.html)**
- **[Keep theme advanced usage](https://keep-docs.xpoet.cn/advanced/set-language.html)**

## :rocket: Installation

If you're using Hexo 5.0 or later, the simplest way to install is through NPM:
Expand All @@ -49,14 +57,6 @@ After the installation, open Hexo config file and set `theme` variable to `keep`
theme: keep
```
## :books: Documents
Please see the official documents of **Keep**.
- **[Keep official document](https://keep-docs.xpoet.cn/)**
- **[Keep theme configuration guide](https://keep-docs.xpoet.cn/basis/configuration-guide/base_info.html)**
- **[Keep theme advanced usage](https://keep-docs.xpoet.cn/advanced/set-language.html)**
## :tada: Update
**Keep** releases new versions from time to time. You can update **Keep** by the following command.
Expand Down
18 changes: 9 additions & 9 deletions docs/README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
语言:
简体中文 |
<a title="English" href="../README.md">English</a> |
<a title="Chinese" href="README_zh-TW.md">繁體中文</a>
<a title="繁體中文" href="README_zh-TW.md">繁體中文</a>
</div>
<a href="https://xpoet.cn"><img align="center" alt="Keep" src="https://keep-docs.xpoet.cn/images/keep-slogan.svg"></a>

Expand All @@ -24,6 +24,14 @@

> 如果你想把自己的博客链接放置在线预览列表里,可以给作者提 PR。
## :books: 文档

请查看 **Keep** 官方文档:

- **[Keep 官方文档](https://keep-docs.xpoet.cn/)**
- **[Keep 主题配置指南](https://keep-docs.xpoet.cn/basis/configuration-guide/base_info.html)**
- **[Keep 主题进阶使用](https://keep-docs.xpoet.cn/advanced/set-language.html)**

## :rocket: 安装

如果你使用 Hexo 5.0 或更高版本,最简单的安装方式是通过 NPM:
Expand All @@ -48,14 +56,6 @@ git clone https://github.com/XPoet/hexo-theme-keep --depth=1 themes/keep
theme: keep
```
## :books: 文档
请查看 **Keep** 官方文档:
- **[Keep 官方文档](https://keep-docs.xpoet.cn/)**
- **[Keep 主题配置指南](https://keep-docs.xpoet.cn/basis/configuration-guide/base_info.html)**
- **[Keep 主题进阶使用](https://keep-docs.xpoet.cn/advanced/set-language.html)**
## :tada: 更新
**Keep** 不定期发布新版本,你可以通过如下命令更新 **Keep**。
Expand Down
18 changes: 9 additions & 9 deletions docs/README_zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
語言:
繁體中文 |
<a title="English" href="../README.md">English</a> |
<a title="Chinese" href="README_zh-CN.md">简体中文</a>
<a title="简体中文" href="README_zh-CN.md">简体中文</a>
</div>

<a href="https://xpoet.cn"><img align="center" alt="Keep" src="https://keep-docs.xpoet.cn/images/keep-slogan.svg"></a>
Expand All @@ -25,6 +25,14 @@

> 如果你想把自己的博客鏈接放在線上預覽列表裏,可以給作者提 PR。
## :books: 文檔

請查看 **Keep** 官方文檔:

- **[Keep 官方文檔](https://keep-docs.xpoet.cn/)**
- **[Keep 主題配置指南](https://keep-docs.xpoet.cn/basis/configuration-guide/base_info.html)**
- **[Keep 主題進階使用](https://keep-docs.xpoet.cn/advanced/set-language.html)**

## :rocket: 安装

如果你使用 Hexo 5.0 或更高版本,最簡單的安裝方式是透過 NPM:
Expand All @@ -49,14 +57,6 @@ git clone https://github.com/XPoet/hexo-theme-keep --depth=1 themes/keep
theme: keep
```
## :books: 文檔
請查看 **Keep** 官方文檔:
- **[Keep 官方文檔](https://keep-docs.xpoet.cn/)**
- **[Keep 主題配置指南](https://keep-docs.xpoet.cn/basis/configuration-guide/base_info.html)**
- **[Keep 主題進階使用](https://keep-docs.xpoet.cn/advanced/set-language.html)**
## :tada: 更新
**Keep** 不定期發布新版本。你可以透過如下命令更新 **Keep**。
Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/footer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const web_master = bi_author || hexo_author
href="<%= item.link_url %>"
target="_blank"
>
<img src="<%= item.img_url %>">
<img src="<%- url_for(item.img_url) %>">
</a>
<% } %>
<% }) %>
Expand Down
6 changes: 3 additions & 3 deletions layout/_partial/scripts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@
<% } %>
<!-- category-page -->
<% if (isCategoriesPage(page.path) === true) { %>
<% if (is_current('/categories') || is_current('/category')) { %>
<%- __js('js/page/category-page.js') %>
<% } %>
<!-- links-page -->
<% if (isLinksPage(page.path) === true) { %>
<% if (is_current('/links') || is_current('/link')) { %>
<%- __js('js/page/links-page.js') %>
<% } %>
<!-- photos-page -->
<% if (isPhotosPage(page.path) === true) { %>
<% if (is_current('/photos') || is_current('/photo')) { %>
<%- __js('js/page/photos-page.js') %>
<% } %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/templates/friends-link.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<a class="a-wrap border-box" href="<%= f?.link %>">
<div class="avatar border-box flex-center">
<i class="icon fas fa-eye-slash"></i>
<img src="<%= f?.avatar %>"
<img src="<%- url_for(f?.avatar) %>"
onerror="this.style.display='none'"
>
</div>
Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/templates/photo-album.ejs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="photo-album-box border-box">
<% for (const img of theme?.photos) { %>
<img class="photo border-box" src="<%= img?.url %>"
<img class="photo border-box" src="<%- url_for(img?.url) %>"
title="<%= img.name %>"
onerror="this.style.display='none'"
>
Expand Down
6 changes: 3 additions & 3 deletions layout/article-content.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const post_avatar = page?.avatar || theme?.base_info?.avatar
<div class="cover-article-title">
<%= page.title %>
</div>
<img class="post-cover" src="<%= page.post_cover || page?.home_cover %>"
<img class="post-cover" src="<%- url_for(page.post_cover || page?.home_cover) %>"
onerror="this.style.display='none'"
>
</div>
Expand Down Expand Up @@ -100,7 +100,7 @@ const post_avatar = page?.avatar || theme?.base_info?.avatar
<div class="article-prev">
<a class="prev"
rel="prev"
href="<%= url_for(page.prev.path) %>"
href="<%- url_for(page.prev.path) %>"
title="<%= page.prev.title %>"
>
<span class="left arrow-icon flex-center">
Expand All @@ -117,7 +117,7 @@ const post_avatar = page?.avatar || theme?.base_info?.avatar
<div class="article-next">
<a class="next"
rel="next"
href="<%= url_for(page.next.path) %>"
href="<%- url_for(page.next.path) %>"
title="<%= page.next.title %>"
>
<span class="title flex-center">
Expand Down
2 changes: 1 addition & 1 deletion layout/home-content.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<i class="fas fa-thumbtack"></i><span class="sticky-name">&nbsp;<%- __('top') %></span>
</div>
<% } %>
<img class="home-cover" src="<%= post.home_cover %>"
<img class="home-cover" src="<%- url_for(post.home_cover) %>"
onerror="this.style.display='none'"
>
</div>
Expand Down
39 changes: 26 additions & 13 deletions layout/page-template.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,34 @@ const use_photo_album = (
%>
<div class="fade-in-down-animation">
<div class="page-template-container border-box">
<% if (use_friends_link && use_page_template) { %>
<%- partial('_partial/templates/friends-link') %>
<% if (page?.page_cover) { %>
<div class="page-template-top border-box"
style="height: <%= page?.page_cover_height ? page?.page_cover_height + 'px' : '13rem' %>"
>
<img class="page-cover" src="<%- url_for(page.page_cover) %>"
onerror="this.style.display='none'"
>
</div>
<% } %>
<% if (use_photo_album && use_page_template) { %>
<%- partial('_partial/templates/photo-album') %>
<% } %>
<div class="page-template-content border-box keep-markdown-body">
<% if (page?.content || use_friends_link || use_photo_album) { %>
<%- page.content %>
<% } else { %>
<h1><%= page_title.toUpperCase() %></h1>
<div class="page-template-bottom border-box">
<% if (use_friends_link && use_page_template) { %>
<%- partial('_partial/templates/friends-link') %>
<% } %>
<% if (use_photo_album && use_page_template) { %>
<%- partial('_partial/templates/photo-album') %>
<% } %>
<div class="page-content border-box keep-markdown-body">
<% if (page?.content || use_friends_link || use_photo_album) { %>
<%- page.content %>
<% } else { %>
<h1><%= page_title.toUpperCase() %></h1>
<% } %>
</div>
<% if (page?.comment === true) { %>
<%- partial('_partial/comment/comment') %>
<% } %>
</div>
<% if (page?.comment === true) { %>
<%- partial('_partial/comment/comment') %>
<% } %>
</div>
</div>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "hexo-theme-keep",
"version": "4.0.2",
"private": false,
"description": "A simple and elegant theme for Hexo.",
"description": "A simple and light theme for Hexo.",
"scripts": {
"format": "prettier --write ./source/js/*.js ./scripts",
"lint:style": "stylelint --fix ./source/css",
Expand Down
46 changes: 27 additions & 19 deletions scripts/filters/image-handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,43 @@ const isAddRootPath = (root, src) => {
}
}

const regExpImg = /<img([^>]*)src="([^"]*)"([^>\/]*)\/?\s*>/gim

hexo.extend.filter.register(
'before_post_render',
function (data) {
const theme = hexo.theme.config
data.content = data.content.replace(regExpImg, function (match, attrBegin, src, attrEnd) {
if (!src) return match
return `<img ${attrBegin} src="${isAddRootPath(theme.root, src)}" ${attrEnd}>`
})
},
1
)

hexo.extend.filter.register(
'after_post_render',
function (data) {
const theme = hexo.theme.config

data.content = data.content.replace(
/<img([^>]*)src="([^"]*)"([^>\/]*)\/?\s*>/gim,
function (match, attrBegin, src, attrEnd) {
if (!src) return match
// image lazy load
if (theme?.lazyload?.enable === true) {
let hasAlt = false
if (attrBegin.includes('alt="')) {
hasAlt = true
}
return `<img ${attrBegin}
data.content = data.content.replace(regExpImg, function (match, attrBegin, src, attrEnd) {
if (!src) return match
// image lazy load
if (theme?.lazyload?.enable === true) {
let hasAlt = false
if (attrBegin.includes('alt="')) {
hasAlt = true
}
return `<img ${attrBegin}
lazyload
${hasAlt ? '' : 'alt="image"'}
data-src="${isAddRootPath(theme.root, src)}"
data-src="${src}"
${attrEnd}
>`
} else {
return `<img ${attrBegin}
src="${isAddRootPath(theme.root, src)}"
${attrEnd}
>`
}
} else {
return `<img ${attrBegin} src="${src}" ${attrEnd}>`
}
)
})
},
1
)
12 changes: 0 additions & 12 deletions scripts/helpers/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,3 @@ hexo.extend.helper.register('isJsFile', function (path) {
hexo.extend.helper.register('isCssFile', function (path) {
return /\.css$/i.test(path)
})

hexo.extend.helper.register('isLinksPage', function (pagePath) {
return pagePath === 'links/index.html'
})

hexo.extend.helper.register('isPhotosPage', function (pagePath) {
return pagePath === 'photos/index.html'
})

hexo.extend.helper.register('isCategoriesPage', function (pagePath) {
return pagePath === 'categories/index.html'
})
7 changes: 4 additions & 3 deletions source/css/common/markdown.styl
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,21 @@
a {
position relative
box-sizing border-box
padding-bottom 0.2rem
padding-bottom 0.1rem
text-decoration none
overflow-wrap break-word
border-bottom 0.1rem solid var(--text-color-4)
outline 0
cursor pointer


.fas
.far
.fab {
position relative
margin 0 0.2rem 0 0.4rem
color var(--text-color-4)
font-size 0.88rem
font-size 0.8rem
}


Expand All @@ -92,7 +93,7 @@
ul
ol {
li {
margin-left 1rem
margin 0.3rem 0 0.3rem 1rem
line-height 2rem
}
}
Expand Down
Loading

0 comments on commit 084e1c7

Please sign in to comment.