Skip to content

Commit

Permalink
Merge pull request #362 from dillonzq/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonzq authored May 15, 2020
2 parents 9f58106 + 8ef1edd commit 8372db7
Show file tree
Hide file tree
Showing 66 changed files with 305 additions and 146 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ I hope you will LoveIt ❤️!
* **Bilibili player** shortcode
* Kinds of **admonitions** shortcode
* **Custom style** shortcode
* **Custom script** shortcode
* **Animated typing** supported by [TypeIt](https://typeitjs.com/)
* **Dynamic scroll** supported by [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
* **Cookie consent banner** supported by [cookieconsent](https://github.com/osano/cookieconsent)
Expand Down
1 change: 1 addition & 0 deletions README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
* 支持 **Bilibili 视频** shortcode
* 支持多种**注释**的 shortcode
* 支持**自定义样式**的 shortcode
* 支持**自定义脚本**的 shortcode
* 支持基于 [TypeIt](https://typeitjs.com/)**打字动画** shortcode
* 支持基于 [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)**滚动动画**
* 支持基于 [cookieconsent](https://github.com/osano/cookieconsent)**Cookie 许可横幅**
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions assets/css/_override.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// ==============================
// Override Variables
// 覆盖变量
// ==============================
4 changes: 3 additions & 1 deletion assets/css/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Variables
// ==============================

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@800&display=swap');

// ========== Global ========== //
// Font and Line Height
$global-font-family: system-ui, -apple-system, BlinkMacSystemFont, PingFang SC, Microsoft YaHei UI, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, Helvetica, Arial, sans-serif !default;
Expand Down Expand Up @@ -57,7 +59,7 @@ $header-background-color: #f8f8f8 !default;
$header-background-color-dark: #252627 !default;

// Font style of the header title
$header-title-font-family: $global-font-family !default;
$header-title-font-family: Nunito, $global-font-family !default;
$header-title-font-size: 1.5rem !default;

// Color of the hover header item
Expand Down
9 changes: 2 additions & 7 deletions assets/css/style.template.scss → assets/css/style.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
@charset "utf-8";

@import "_variables";

{{- if fileExists "config/css/_override.scss" -}}
@import "_override";
{{- end -}}
@import "_override";

@import "_mixin/index";

Expand All @@ -19,6 +16,4 @@

@import "_core/media";

{{- if fileExists "config/css/_custom.scss" -}}
@import "_custom";
{{- end -}}
@import "_custom";
11 changes: 6 additions & 5 deletions assets/lib/polyfill.yml → assets/data/polyfill.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
theme:
- html5shiv
- Object.values
- Promise
- fetch
- Element.prototype.after
smooth-scroll:
- Element.prototype.closest
- requestAnimationFrame
Expand All @@ -14,8 +20,3 @@ TypeIt:
- Math.sign
- Object.assign
- Promise
theme:
- Object.values
- Promise
- fetch
- Element.prototype.after
2 changes: 1 addition & 1 deletion assets/js/theme.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/theme.min.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions exampleSite/assets/css/_custom.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// ==============================
// Custom style
// 自定义样式
// ==============================
4 changes: 4 additions & 0 deletions exampleSite/assets/css/_override.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// ==============================
// Override Variables
// 覆盖变量
// ==============================
12 changes: 11 additions & 1 deletion exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ enableEmoji = true
recordIP = true
highlight = true
enableQQ = false
serverURLs = ""
serverURLs = "https://leancloud.hugoloveit.com"
# emoji data file name, default is "google.yml"
# ("apple.yml", "google.yml", "facebook.yml", "twitter.yml")
# located in "themes/LoveIt/assets/data/emoji/" directory
Expand Down Expand Up @@ -1025,6 +1025,16 @@ enableEmoji = true
# "assets/data/cdn/"
data = "jsdelivr.yml"

# Compatibility config
# 兼容性设置
[params.compatibility]
# whether to use Polyfill.io to be compatible with older browsers
# 是否使用 Polyfill.io 来兼容旧式浏览器
polyfill = false
# whether to use object-fit-images to be compatible with older browsers
# 是否使用 object-fit-images 来兼容旧式浏览器
objectFit = false

# Markup related configuration in Hugo
# Hugo 解析文档的配置
[markup]
Expand Down
8 changes: 0 additions & 8 deletions exampleSite/config/css/_override.scss

This file was deleted.

1 change: 1 addition & 0 deletions exampleSite/content/about/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ math:
* :(fas fa-video fa-fw): **Bilibili player** shortcode
* :(far fa-bell fa-fw): Kinds of **admonitions** shortcode
* :(fas fa-align-left fa-fw): **Custom style** shortcode
* :(fab fa-js-square fa-fw): **Custom script** shortcode
* :(fas fa-i-cursor fa-fw): **Animated typing** supported by [TypeIt](https://typeitjs.com/)
* :(fas fa-arrow-down fa-fw): **Dynamic scroll** supported by [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
* :(fas fa-cookie-bite fa-fw): **Cookie consent banner** supported by [cookieconsent](https://github.com/osano/cookieconsent)
Expand Down
1 change: 1 addition & 0 deletions exampleSite/content/about/index.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Welcome to take the time to propose a translation by [:(fas fa-code-branch fa-fw
* :(fas fa-video fa-fw): **Bilibili player** shortcode
* :(far fa-bell fa-fw): Kinds of **admonitions** shortcode
* :(fas fa-align-left fa-fw): **Custom style** shortcode
* :(fab fa-js-square fa-fw): **Custom script** shortcode
* :(fas fa-i-cursor fa-fw): **Animated typing** supported by [TypeIt](https://typeitjs.com/)
* :(fas fa-arrow-down fa-fw): **Dynamic scroll** supported by [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
* :(fas fa-cookie-bite fa-fw): **Cookie consent banner** supported by [cookieconsent](https://github.com/osano/cookieconsent)
Expand Down
1 change: 1 addition & 0 deletions exampleSite/content/about/index.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ math:
* :(fas fa-video fa-fw): 支持 **Bilibili 视频** shortcode
* :(far fa-bell fa-fw): 支持多种**注释**的 shortcode
* :(fas fa-align-left fa-fw): 支持**自定义样式**的 shortcode
* :(fab fa-js-square fa-fw): 支持**自定义脚本**的 shortcode
* :(fas fa-i-cursor fa-fw): 支持基于 [TypeIt](https://typeitjs.com/)**打字动画** shortcode
* :(fas fa-arrow-down fa-fw): 支持基于 [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)**滚动动画**
* :(fas fa-cookie-bite fa-fw): 支持基于 [cookieconsent](https://github.com/osano/cookieconsent)**Cookie 许可横幅**
Expand Down
22 changes: 19 additions & 3 deletions exampleSite/content/posts/theme-documentation-basics/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ theme = "LoveIt"
url = "/categories/"
title = ""
weight = 3

# Markup related configuration in Hugo
[markup]
# Syntax Highlighting (https://gohugo.io/content-management/syntax-highlighting)
[markup.highlight]
# false is a necessary configuration (https://github.com/dillonzq/LoveIt/issues/158)
noClasses = false
```

{{< admonition >}}
Expand Down Expand Up @@ -634,6 +641,13 @@ Please open the code block below to view the complete sample configuration :(far
# "assets/data/cdn/"
data = ""

# {{< version 0.2.8 >}} Compatibility config
[params.compatibility]
# whether to use Polyfill.io to be compatible with older browsers
polyfill = false
# whether to use object-fit-images to be compatible with older browsers
objectFit = false

# Markup related config in Hugo
[markup]
# {{< link "https://gohugo.io/content-management/syntax-highlighting" "Syntax Highlighting" >}}
Expand Down Expand Up @@ -792,15 +806,17 @@ Add a logo image (127x40) and a cover image (800x600) in the `static` directory.

### 3.4 Style Customization

{{< version 0.2.8 changed >}}

{{< admonition >}}
Hugo **extended** version is necessary for the style customization.
{{< /admonition >}}

**LoveIt** theme has been built to be as configurable as possible by defining custom `.scss` style files.

The directory including the custom `.scss` style files is `config/css` relative to **your project root directory**.
The directory including the custom `.scss` style files is `assets/css` relative to **your project root directory**.

In `config/css/_override.scss`, you can override the variables in `themes/LoveIt/assets/css/_variables.scss` to customize the style.
In `assets/css/_override.scss`, you can override the variables in `themes/LoveIt/assets/css/_variables.scss` to customize the style.

Here is a example:

Expand All @@ -809,7 +825,7 @@ Here is a example:
$code-font-family: Fira Mono, Source Code Pro, Menlo, Consolas, Monaco, monospace;
```

In `config/css/_custom.scss`, you can add some css style code to customize the style.
In `assets/css/_custom.scss`, you can add some css style code to customize the style.

## 4 Multilingual and i18n

Expand Down
22 changes: 19 additions & 3 deletions exampleSite/content/posts/theme-documentation-basics/index.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ theme = "LoveIt"
url = "/categories/"
title = ""
weight = 3

# Markup related configuration in Hugo
[markup]
# Syntax Highlighting (https://gohugo.io/content-management/syntax-highlighting)
[markup.highlight]
# false is a necessary configuration (https://github.com/dillonzq/LoveIt/issues/158)
noClasses = false
```

{{< admonition >}}
Expand Down Expand Up @@ -639,6 +646,13 @@ Please open the code block below to view the complete sample configuration :(far
# "assets/data/cdn/"
data = ""

# {{< version 0.2.8 >}} Compatibility config
[params.compatibility]
# whether to use Polyfill.io to be compatible with older browsers
polyfill = false
# whether to use object-fit-images to be compatible with older browsers
objectFit = false

# Markup related config in Hugo
[markup]
# {{< link "https://gohugo.io/content-management/syntax-highlighting" "Syntax Highlighting" >}}
Expand Down Expand Up @@ -797,15 +811,17 @@ Add a logo image (127x40) and a cover image (800x600) in the `static` directory.

### 3.4 Style Customization

{{< version 0.2.8 changed >}}

{{< admonition >}}
Hugo **extended** version is necessary for the style customization.
{{< /admonition >}}

**LoveIt** theme has been built to be as configurable as possible by defining custom `.scss` style files.

The directory including the custom `.scss` style files is `config/css` relative to **your project root directory**.
The directory including the custom `.scss` style files is `assets/css` relative to **your project root directory**.

In `config/css/_override.scss`, you can override the variables in `themes/LoveIt/assets/css/_variables.scss` to customize the style.
In `assets/css/_override.scss`, you can override the variables in `themes/LoveIt/assets/css/_variables.scss` to customize the style.

Here is a example:

Expand All @@ -814,7 +830,7 @@ Here is a example:
$code-font-family: Fira Mono, Source Code Pro, Menlo, Consolas, Monaco, monospace;
```

In `config/css/_custom.scss`, you can add some css style code to customize the style.
In `assets/css/_custom.scss`, you can add some css style code to customize the style.

## 4 Multilingual and i18n

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ theme = "LoveIt"
url = "/categories/"
title = ""
weight = 3

# Hugo 解析文档的配置
[markup]
# 语法高亮设置 (https://gohugo.io/content-management/syntax-highlighting)
[markup.highlight]
# false 是必要的设置 (https://github.com/dillonzq/LoveIt/issues/158)
noClasses = false
```

{{< admonition >}}
Expand Down Expand Up @@ -637,6 +644,13 @@ hugo
# "assets/data/cdn/"
data = ""

# {{< version 0.2.8 >}} 兼容性设置
[params.compatibility]
# 是否使用 Polyfill.io 来兼容旧式浏览器
polyfill = false
# 是否使用 object-fit-images 来兼容旧式浏览器
objectFit = false

# Hugo 解析文档的配置
[markup]
# {{< link "https://gohugo.io/content-management/syntax-highlighting" "语法高亮设置" >}}
Expand Down Expand Up @@ -796,15 +810,17 @@ hugo

### 3.4 自定义样式

{{< version 0.2.8 changed >}}

{{< admonition >}}
Hugo **extended** 版本对于自定义样式是必需的.
{{< /admonition >}}

通过定义自定义 `.scss` 样式文件, **LoveIt** 主题支持可配置的样式.

包含自定义 `.scss` 样式文件的目录相对于 **你的项目根目录** 的路径为 `config/css`.
包含自定义 `.scss` 样式文件的目录相对于 **你的项目根目录** 的路径为 `assets/css`.

`config/css/_override.scss` 中, 你可以覆盖 `themes/LoveIt/assets/css/_variables.scss` 中的变量以自定义样式.
`assets/css/_override.scss` 中, 你可以覆盖 `themes/LoveIt/assets/css/_variables.scss` 中的变量以自定义样式.

这是一个例子:

Expand All @@ -813,7 +829,7 @@ Hugo **extended** 版本对于自定义样式是必需的.
$code-font-family: Fira Mono, Source Code Pro, Menlo, Consolas, Monaco, monospace;
```

`config/css/_custom.scss` 中, 你可以添加一些 CSS 样式代码以自定义样式.
`assets/css/_custom.scss` 中, 你可以添加一些 CSS 样式代码以自定义样式.

## 4 多语言和 i18n

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Hugo **extended** version is necessary for `style` shortcode.
The `style` shortcode has two positional parameters.

The **first** one is the custom style content,
which supports nesting syntax in [SASS](https://sass-lang.com/documentation/style-rules/declarations#nesting)
which supports nesting syntax in [:(fab fa-sass fa-fw): SASS](https://sass-lang.com/documentation/style-rules/declarations#nesting)
and `&` referring to this parent HTML element.

And the **second** one is the tag name of the HTML element wrapping the content you want to change style, and whose default value is `div`.
Expand Down Expand Up @@ -1265,3 +1265,27 @@ The rendered output looks like this:
{{< typeit group=paragraph >}}
**Then** this paragraph begins
{{< /typeit >}}

## 11 script

{{< version 0.2.8 >}}

`script` is a shortcode to insert custom **:(fab fa-js fa-fw): Javascript** in your post.

{{< admonition >}}
The script content can be guaranteed to be executed in order after all third-party libraries are loaded. So you are free to use third-party libraries.
{{< /admonition >}}

Example `script` input:

```markdown
{{</* script */>}}
console.log('Hello LoveIt!');
{{</* /script */>}}
```

You can see the output in the console of the developer tool.

{{< script >}}
console.log('Hello LoveIt!');
{{< /script >}}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Hugo **extended** version is necessary for `style` shortcode.
The `style` shortcode has two positional parameters.

The **first** one is the custom style content,
which supports nesting syntax in [SASS](https://sass-lang.com/documentation/style-rules/declarations#nesting)
which supports nesting syntax in [:(fab fa-sass fa-fw): SASS](https://sass-lang.com/documentation/style-rules/declarations#nesting)
and `&` referring to this parent HTML element.

And the **second** one is the tag name of the HTML element wrapping the content you want to change style, and whose default value is `div`.
Expand Down Expand Up @@ -1270,3 +1270,27 @@ The rendered output looks like this:
{{< typeit group=paragraph >}}
**Then** this paragraph begins
{{< /typeit >}}

## 11 script

{{< version 0.2.8 >}}

`script` is a shortcode to insert custom **:(fab fa-js fa-fw): Javascript** in your post.

{{< admonition >}}
The script content can be guaranteed to be executed in order after all third-party libraries are loaded. So you are free to use third-party libraries.
{{< /admonition >}}

Example `script` input:

```markdown
{{</* script */>}}
console.log('Hello LoveIt!');
{{</* /script */>}}
```

You can see the output in the console of the developer tool.

{{< script >}}
console.log('Hello LoveIt!');
{{< /script >}}
Loading

0 comments on commit 8372db7

Please sign in to comment.