Skip to content

Commit

Permalink
v0.8.0
Browse files Browse the repository at this point in the history
* Improve: flexsearch multilingual search capability
* Improve: widen the control range of navbar menu items
* Change: flexsearch can now search index pages
* Change: the post content in RSS is changed from summary to full text
* Add: collapsible TOC and Changelogs
  • Loading branch information
kaiiiz committed Jul 29, 2021
2 parents 09c8b37 + cd8fdf5 commit 8c96d83
Show file tree
Hide file tree
Showing 27 changed files with 301 additions and 56 deletions.
37 changes: 36 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,39 @@ dist
# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# End of https://www.toptal.com/developers/gitignore/api/node
# End of https://www.toptal.com/developers/gitignore/api/node


# Created by https://www.toptal.com/developers/gitignore/api/macos
# Edit at https://www.toptal.com/developers/gitignore?templates=macos

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# End of https://www.toptal.com/developers/gitignore/api/macos
4 changes: 3 additions & 1 deletion assets/css/components/color.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,10 @@ body {
@apply text-900 border-200 border-500-hover;
}

.toc-wrapper {
.collapsible-menu-wrapper {
@apply border-200;
@apply fill-900;
@apply text-900;
}

.gallery-item {
Expand Down
35 changes: 26 additions & 9 deletions assets/css/components/content.pcss
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
#content {
#TableOfContents {
@apply ml-2 text-sm;
#TableOfContents {
ul ul {
@apply ml-2;
}

ul ul {
@apply ml-2;
}
li {
@apply mt-1.5;
}
}

.collapsible-menu-wrapper {
.collapse-btn-input:checked ~ div > .collapse-btn {
transform: rotate(90deg);
}

.collapse-btn-input ~ .collapsible-menu {
@apply hidden;
}

.collapse-btn-input:checked ~ .collapsible-menu {
@apply block;
}

li {
@apply mt-1.5;
}
.collapse-btn {
@apply cursor-pointer;
transition: all 0.1s ease-out;
transform-origin: 11px 12px;
transform: rotate(0deg);
}
}
7 changes: 6 additions & 1 deletion assets/css/components/header.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,14 @@ header {
.navbar-dropdown {
@apply absolute rounded-sm hidden w-max shadow-xl z-10;

li {
a {
@apply px-2.5 py-2;
}

a, a:visited, a:hover, a:active {
color: inherit;
fill: inherit;
}
}

&:hover > .navbar-dropdown {
Expand Down
24 changes: 12 additions & 12 deletions assets/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@ async function init() {
const ascii_index = new Document({
id: "id",
index: ["title","content"],
profile: "score",
tokenize: 'forward',
encode: str => str.replace(/[^\x00-\x7F]/g, "").split(" "),
store: true,
});
const nonascii_index = new Document({
id: "id",
index: ["title","content"],
encode: false,
tokenize: function(str){
return str.replace(/[\x00-\x7F]/g, "").split("");
},
encode: str => str.replace(/[\x00-\x7F]/g, "").split(""),
store: true,
});
index_json.forEach(post => {
Expand Down Expand Up @@ -85,15 +83,17 @@ async function init() {

const search = (value) => {
clearAllItems();
let res = ascii_index.search(value);
if (res.length == 0) {
res = nonascii_index.search(value);
let ascii_res = ascii_index.search(value);
let nonascii_res = nonascii_index.search(value);

let reduce_res_to_id = (res) => {
return res.reduce((acc, curr) => {
curr.result.forEach(x => acc.add(x));
return acc;
}, new Set());
}

res_id = res.reduce((acc, curr) => {
curr.result.forEach(x => acc.add(x));
return acc;
}, new Set());
let res_id = new Set([...reduce_res_to_id(ascii_res), ...reduce_res_to_id(nonascii_res)])

res = Array.from(res_id).reduce((acc, id) => {
acc.push(ascii_index.get(id));
Expand Down
4 changes: 4 additions & 0 deletions exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ enableCodeCopy = true
enableOpenGraph = true
enableTwitterCards = true
author = "kaiiiz"

# Collapsible Menu
enableCollapsibleTOC = false
enableCollapsibleChangelogs = true
1 change: 1 addition & 0 deletions exampleSite/content/en/about/timeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gallery_statistic:
value: value3
---

* 2021/07/29 - v0.8.0 release
* 2021/07/08 - v0.7.1 release
* 2021/06/24 - v0.7.0 release
* 2021/04/15 - v0.6.2 release
Expand Down
8 changes: 8 additions & 0 deletions exampleSite/content/en/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ toc: false

## Changelog

### v0.8.0 - 2021/07/29

* Improve: flexsearch multilingual search capability
* Improve: widen the control range of navbar menu items
* Change: flexsearch can now search index pages
* Change: the post content in RSS is changed from summary to full text
* Add: collapsible TOC and Changelogs

### v0.7.1 - 2021/07/08

* Change: adjust the style of changelogs
Expand Down
25 changes: 24 additions & 1 deletion exampleSite/content/en/configuration/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ weight: 3
bookcase_cover_src: 'cover/catalogue.png'
bookcase_cover_src_dark: 'cover/catalogue_dark.png'
changelogs:
- tag: '[v0.7.0](/hugo-theme-monochrome/changelog/#v070---20210624)'
- tag: 'v0.7.0'
description:
- 'Add `changelogs` property'
- "Update `disqus` fallback policy for none post pages"
- tag: 'v0.8.0'
description:
- 'Add `collapsibleTOC` and `collapsibleChangelogs` properties'
---

# Page Settings
Expand Down Expand Up @@ -52,6 +55,16 @@ toc: false

> default: theme's [`enableTOC`](/hugo-theme-monochrome/configuration/theme/#table-of-contents)
### Collapsible Table of Contents

```yaml
---
collapsibleTOC: false
---
```

> default: theme's [`enableCollapsibleTOC`](/hugo-theme-monochrome/configuration/theme/#collapsible-menu)
## Changelogs

```yaml
Expand All @@ -72,6 +85,16 @@ tag and description fields support markdown syntax.

> default: None
### Collapsible Changelogs

```yaml
---
collapsibleChangelogs: false
---
```

> default: theme's [`enableCollapsibleChangelogs`](/hugo-theme-monochrome/configuration/theme/#collapsible-menu)
## External library

### MathJax
Expand Down
24 changes: 24 additions & 0 deletions exampleSite/content/en/configuration/theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: 'Theme Settings'
weight: 2
bookcase_cover_src: 'cover/catalogue.png'
bookcase_cover_src_dark: 'cover/catalogue_dark.png'
changelogs:
- tag: 'v0.8.0'
description:
- 'Add `enableCollapsibleTOC` and `enableCollapsibleChangelogs` properties'
---

# Theme Configuration
Expand Down Expand Up @@ -40,6 +44,26 @@ enableTOC = false

> default: true
## Collapsible Menu

To enable the collapsible TOC globally, add:

```toml
[params]
enableCollapsibleTOC = true
```

> default: false
To enable the collapsible changelogs globally, add:

```toml
[params]
enableCollapsibleChangelogs = true
```

> default: false
## Navbar menu

Monochrome uses built-in menu system supported by hugo itself. (Checkout [document](https://gohugo.io/content-management/menus) for more deatil.) By default, the menu called `navbar` is used to decide which item need to be rendered on the navbar.
Expand Down
1 change: 1 addition & 0 deletions exampleSite/content/zh-tw/about/timeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gallery_statistic:
value: value3
---

* 2021/07/29 - v0.8.0 release
* 2021/07/08 - v0.7.1 release
* 2021/06/24 - v0.7.0 release
* 2021/04/15 - v0.6.2 release
Expand Down
8 changes: 8 additions & 0 deletions exampleSite/content/zh-tw/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ toc: false

## Changelog

### v0.8.0 - 2021/07/29

* Improve: flexsearch multilingual search capability
* Improve: widen the control range of navbar menu items
* Change: flexsearch can now search index pages
* Change: the post content in RSS is changed from summary to full text
* Add: collapsible TOC and Changelogs

### v0.7.1 - 2021/07/08

* Change: adjust the style of changelogs
Expand Down
26 changes: 25 additions & 1 deletion exampleSite/content/zh-tw/configuration/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ weight: 3
bookcase_cover_src: 'cover/catalogue.png'
bookcase_cover_src_dark: 'cover/catalogue_dark.png'
changelogs:
- tag: '[v0.7.0](/hugo-theme-monochrome/zh-tw/changelog/#v070---20210624)'
- tag: 'v0.7.0'
description:
- "新增 `changelogs` 屬性"
- "更新對非文章頁面的 `disqus` 屬性的 fallback policy"
- tag: 'v0.8.0'
description:
- '新增 `collapsibleTOC` 及 `collapsibleChangelogs` 屬性'
---

# 頁面設定
Expand Down Expand Up @@ -52,6 +55,16 @@ toc: false

> default: theme's [`enableTOC`](/hugo-theme-monochrome/zh-tw/configuration/theme/#table-of-contents)
### Collapsible Table of Contents

```yaml
---
collapsibleTOC: false
---
```

> default: theme's [`enableCollapsibleTOC`](/hugo-theme-monochrome/zh-tw/configuration/theme/#collapsible-menu)
## Changelogs

```yaml
Expand All @@ -72,6 +85,17 @@ tag 與 description 欄位支援 markdown

> default: None
### Collapsible Changelogs

```yaml
---
collapsibleChangelogs: false
---
```

> default: theme's [`enableCollapsibleChangelogs`](/hugo-theme-monochrome/zh-tw/configuration/theme/#collapsible-menu)

## External library

### MathJax
Expand Down
24 changes: 24 additions & 0 deletions exampleSite/content/zh-tw/configuration/theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: '主題設定'
weight: 2
bookcase_cover_src: 'cover/catalogue.png'
bookcase_cover_src_dark: 'cover/catalogue_dark.png'
changelogs:
- tag: 'v0.8.0'
description:
- '新增 `enableCollapsibleTOC` 及 `enableCollapsibleChangelogs` 屬性'
---

# 主題設定
Expand Down Expand Up @@ -40,6 +44,26 @@ enableTOC = false

> default: true
## Collapsible Menu

若要全局開啟支援折疊的 TOC:

```toml
[params]
enableCollapsibleTOC = true
```

> default: false
若要全局開啟支援折疊的 Changelogs:

```toml
[params]
enableCollapsibleChangelogs = true
```

> default: false
## Navbar menu

Monochrome 使用 hugo 內建的 menu 系統,參考 [官方文件](https://gohugo.io/content-management/menus)。預設 `navbar` 這個 menu 會被拿來渲染到頂部。
Expand Down
Loading

0 comments on commit 8c96d83

Please sign in to comment.