Skip to content

Commit

Permalink
feat(search): add local search (dillonzq#231)
Browse files Browse the repository at this point in the history
* feat(search): add local search

* docs: add docs for search
  • Loading branch information
dillonzq authored Apr 15, 2020
1 parent b6ce753 commit 90184ca
Show file tree
Hide file tree
Showing 92 changed files with 4,823 additions and 1,194 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ Compared to the original LeaveIt theme and the KeepIt theme, the LoveIt theme ha
* Some beautiful **CSS animations**
* Easy-to-use and self-expanding **table of contents**
* More **social links**, **share sites** and **comment system**
* Extended markdown syntax for **[Font Awesome](https://fontawesome.com/) icons**
* Extended markdown syntax for **ruby annotation**
* Extended markdown syntax for **fraction**
* **Search** supported by [Lunr.js](https://lunrjs.com/) or [algolia](https://www.algolia.com/)
* Extended Markdown syntax for **[Font Awesome](https://fontawesome.com/) icons**
* Extended Markdown syntax for **ruby annotation**
* Extended Markdown syntax for **fraction**
* **Mathematical formula** supported by [KaTeX](https://katex.org/)
* **Diagram syntax** shortcode supported by [mermaid](https://github.com/knsv/mermaid)
* **Interactive data visualization** shortcode supported by [ECharts](https://echarts.apache.org/)
Expand Down Expand Up @@ -89,11 +90,12 @@ I hope you will LoveIt ❤️!

### Extended Features

* **Search** supported by [Lunr.js](https://lunrjs.com/) or [algolia](https://www.algolia.com/)
* Automatically **highlighting** code
* **Images gallery** supported by [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js)
* Extended markdown syntax for **[Font Awesome](https://fontawesome.com/) icons**
* Extended markdown syntax for **ruby annotation**
* Extended markdown syntax for **fraction**
* Extended Markdown syntax for **[Font Awesome](https://fontawesome.com/) icons**
* Extended Markdown syntax for **ruby annotation**
* Extended Markdown syntax for **fraction**
* **Mathematical formula** supported by [KaTeX](https://katex.org/)
* **Diagrams** shortcode supported by [mermaid](https://github.com/knsv/mermaid)
* **Interactive data visualization** shortcode supported by [ECharts](https://echarts.apache.org/)
Expand Down Expand Up @@ -128,9 +130,13 @@ Thanks to the authors of following resources included in the theme:
* [Font Awesome](https://fontawesome.com/)
* [Fork Awesome](https://forkaweso.me/Fork-Awesome/)
* [Animate.css](https://daneden.github.io/animate.css/)
* [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
* [autocomplete.js](https://github.com/algolia/autocomplete.js)
* [Lunr.js](https://lunrjs.com/)
* [algoliasearch](https://github.com/algolia/algoliasearch-client-javascript)
* [Sharer.js](https://github.com/ellisonleao/sharer.js)
* [lazysizes](https://github.com/aFarkas/lazysizes)
* [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js)
* [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
* [TypeIt](https://typeitjs.com/)
* [KaTeX](https://katex.org/)
* [mermaid](https://github.com/knsv/mermaid)
Expand Down
8 changes: 7 additions & 1 deletion README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* 一些美观的 **CSS 动画**
* 易用和自动展开的**文章目录**
* 支持更多的**社交链接****网站分享****评论系统**
* 支持基于 [Lunr.js](https://lunrjs.com/)[algolia](https://www.algolia.com/)**搜索**
* 支持基于 **[Font Awesome](https://fontawesome.com/) 图标**的扩展 Markdown 语法
* 支持**上标注释**的扩展 Markdown 语法
* 支持**分数**的扩展 Markdown 语法
Expand Down Expand Up @@ -84,6 +85,7 @@

### 扩展功能

* 支持基于 [Lunr.js](https://lunrjs.com/)[algolia](https://www.algolia.com/)**搜索**
* 支持**代码高亮**
* 支持基于 [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js)**图片画廊**
* 支持 **[Font Awesome](https://fontawesome.com/) 图标**的扩展 Markdown 语法
Expand Down Expand Up @@ -123,9 +125,13 @@ LoveIt 主题中用到了以下项目,感谢它们的作者:
* [Font Awesome](https://fontawesome.com/)
* [Fork Awesome](https://forkaweso.me/Fork-Awesome/)
* [Animate.css](https://daneden.github.io/animate.css/)
* [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
* [autocomplete.js](https://github.com/algolia/autocomplete.js)
* [Lunr.js](https://lunrjs.com/)
* [algoliasearch](https://github.com/algolia/algoliasearch-client-javascript)
* [Sharer.js](https://github.com/ellisonleao/sharer.js)
* [lazysizes](https://github.com/aFarkas/lazysizes)
* [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js)
* [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
* [TypeIt](https://typeitjs.com/)
* [KaTeX](https://katex.org/)
* [mermaid](https://github.com/knsv/mermaid)
Expand Down
1 change: 1 addition & 0 deletions archetypes/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ license: ""
tags: []
categories: []
hiddenFromHomePage: false
hiddenFromSearch: false

featuredImage: ""
featuredImagePreview: ""
Expand Down
34 changes: 8 additions & 26 deletions assets/css/_core/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ html {

/* scrollbar, only support webkit */
::-webkit-scrollbar {
width: 6px;
height: 6px;
width: .5rem;
height: .5rem;
}

::-webkit-scrollbar-thumb {
Expand All @@ -22,44 +22,26 @@ html {
}

::selection {
background: $selection-color;
background-color: $selection-color;

.dark-theme & {
background: $selection-color-dark;
.dark & {
background-color: $selection-color-dark;
}
}

body {
-webkit-font-smoothing: subpixel-antialiased;
background-color: $global-background-color;
color: $global-font-color;
overflow-wrap: break-word;

&::before {
content: "";
background-repeat: no-repeat;
background-position: center;
opacity: 0.05;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: grayscale(100%);
filter: gray;
}

&.dark-theme {
&.dark {
color: $global-font-color-dark;
background-color: $global-background-color-dark;
}
}

@import "../_partial/mask";

a {
text-decoration: none;
}
Expand Down
8 changes: 0 additions & 8 deletions assets/css/_core/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,3 @@
}
}
}

.footer {
height: 2rem;
width: 100%;
text-align: center;
line-height: 1.5rem;
padding-top: 2rem;
}
20 changes: 12 additions & 8 deletions assets/css/_core/_media.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
}

@media only screen and (max-width: 960px) {
.page {
max-width: 80%;
#toc-auto {
display: none;
}

#toc-auto {
display: none;
}
#toc-static {
display: block;
}

#toc-static {
display: block;
}
.page {
max-width: 80%;
}
}

Expand All @@ -33,6 +33,10 @@
display: block;
}

body.blur {
overflow: hidden;
}

.page {
max-width: 100%;
padding-top: $page-padding-top-mobile;
Expand Down
5 changes: 5 additions & 0 deletions assets/css/_mixin/_blur.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@mixin blur {
.blur & {
@include filter(blur(1.5px));
}
}
69 changes: 69 additions & 0 deletions assets/css/_mixin/_compatibility.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
@mixin border-radius($value) {
-webkit-border-radius: $value;
-moz-border-radius: $value;
border-radius: $value;
}

@mixin box-shadow($value) {
-webkit-box-shadow: $value;
box-shadow: $value;
}

@mixin transition($values...) {
-webkit-transition: $values;
-moz-transition: $values;
-o-transition: $values;
transition: $values;
}

@mixin transform($value) {
-webkit-transform: $value;
-moz-transform: $value;
-ms-transform: $value;
-o-transform: $value;
transform: $value;
}

@mixin filter($value) {
-webkit-filter: $value;
-moz-filter: $value;
-ms-filter: $value;
filter: $value;
}

@mixin flex($value) {
-webkit-flex: $value;
flex: $value;
}

@mixin box($orient) {
display: -moz-box;
display: -webkit-box;
display: box;

-moz-box-orient: $orient;
-webkit-box-orient: $orient;
box-orient: $orient;
}

@mixin placeholder($color) {
input::-webkit-input-placeholder{
color: $color;
}

input:-moz-placeholder{
color: $color;
}

input::-moz-placeholder{
color: $color;
}

input:-ms-input-placeholder{
color: $color;
}

input::placeholder {
color: $color;
}
}
2 changes: 2 additions & 0 deletions assets/css/_mixin/_index.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
@import "_compatibility";
@import "_link";
@import "_blur";
@import "_summary";
4 changes: 2 additions & 2 deletions assets/css/_mixin/_link.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
a {
color: if($light, $global-link-color, $single-link-color);

.dark-theme & {
.dark & {
color: if($dark, $global-link-color-dark, $single-link-color-dark);
}

&:active,
&:hover {
color: if($light, $global-link-hover-color, $single-link-hover-color);

.dark-theme & {
.dark & {
color: if($dark, $global-link-hover-color-dark, $single-link-hover-color-dark);
}
}
Expand Down
13 changes: 5 additions & 8 deletions assets/css/_mixin/_summary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
color: $global-font-color;
border-bottom: 1px dashed $global-border-color;

.dark-theme & {
.dark & {
color: $global-font-color-dark;
border-bottom: 1px dashed $global-border-color-dark;
}
Expand Down Expand Up @@ -33,10 +33,7 @@
}

.content {
display: -moz-box;
display: -webkit-box;
-moz-box-orient: vertical;
-webkit-box-orient: vertical;
@include box(vertical);
-webkit-line-clamp: 3;
margin-top: .3rem;
width: 100%;
Expand All @@ -45,7 +42,7 @@
overflow-wrap: break-word;
color: $global-font-secondary-color;

.dark-theme & {
.dark & {
color: $global-font-secondary-color-dark;
}

Expand Down Expand Up @@ -76,7 +73,7 @@
margin-right: .3125rem;
color: $global-link-color;

.dark-theme & {
.dark & {
color: $global-link-color-dark;
}
}
Expand All @@ -93,7 +90,7 @@
@include link(true, true);

b, strong {
.dark-theme & {
.dark & {
color: $global-font-secondary-color-dark;
}
}
Expand Down
2 changes: 1 addition & 1 deletion assets/css/_page/_404.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#content-404 {
font-size: 1.8rem;
line-height: 3rem;
transform: translateY(30vh);
@include transform(translateY(30vh));
text-align: center;
}
Loading

0 comments on commit 90184ca

Please sign in to comment.