feat(shortcode): add link shortcode (#179)

* feat(shortcode): add link shortcode

* docs: add docs for link shortcode

* docs: fix 'mailto' in link shortcode docs error
This commit is contained in:
Dillon 2020-03-17 21:16:04 +08:00 committed by GitHub
parent f9dba2e36c
commit 6b03c711ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 375 additions and 252 deletions

View file

@ -5,7 +5,7 @@
[![License](https://img.shields.io/github/license/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/blob/master/LICENSE)
[![CircleCI](https://img.shields.io/circleci/build/github/dillonzq/LoveIt/develop?label=CI&style=flat-square&logo=circleci)](https://app.circleci.com/pipelines/github/dillonzq/LoveIt)
English README | [中文说明](README.zh-cn.md)
English README | [中文说明](https://github.com/dillonzq/LoveIt/blob/master/README.zh-cn.md)
**LoveIt** is a **clean**, **elegant** but **advanced** blog theme for [Hugo](https://gohugo.io/).
@ -14,7 +14,7 @@ It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt/) a
Since the three themes have a similar look, if you have questions about their differences,
read [Why choose LoveIt](#why-choose-loveit) so that you can choose the one that works best for you.
![Hugo Theme LoveIt](https://github.com/dillonzq/LoveIt/raw/develop/images/Apple-Devices-Preview.png)
![Hugo Theme LoveIt](https://github.com/dillonzq/LoveIt/raw/master/images/Apple-Devices-Preview.png)
## [Demo Site](https://hugoloveit.com/)

View file

@ -5,7 +5,7 @@
[![License](https://img.shields.io/github/license/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/blob/master/LICENSE)
[![CircleCI](https://img.shields.io/circleci/build/github/dillonzq/LoveIt/develop?label=CI&style=flat-square&logo=circleci)](https://app.circleci.com/pipelines/github/dillonzq/LoveIt)
[English README](README.md) | 中文说明
[English README](https://github.com/dillonzq/LoveIt/blob/master/README.md) | 中文说明
[LoveIt](https://github.com/dillonzq/LoveIt) 是一个**简洁**、**优雅**且**高效**的 [Hugo](https://gohugo.io/) 博客主题。
@ -13,7 +13,7 @@
由于三个主题外观的相似性,如果你对于它们的不同之处有疑问,请阅读 [为什么选择 LoveIt](#为什么选择-LoveIt),以便你能选择最适合你的一个。
![Hugo 主题 LoveIt](https://github.com/dillonzq/LoveIt/raw/develop/images/Apple-Devices-Preview.png)
![Hugo 主题 LoveIt](https://github.com/dillonzq/LoveIt/raw/master/images/Apple-Devices-Preview.png)
## 主题[预览](https://hugoloveit.com/zh-cn/)

View file

@ -60,20 +60,9 @@ body {
}
a {
color: $global-link-color;
text-decoration: none;
&:hover {
color: $global-link-hover-color;
}
.dark-theme & {
color: $global-link-color-dark;
&:hover {
color: $global-link-hover-color-dark;
}
}
}
@include link(true, true);
@import "../_partial/fixed-button";

View file

@ -0,0 +1,2 @@
@import "_link";
@import "_summary";

View file

@ -0,0 +1,18 @@
@mixin link($light, $dark) {
a {
color: if($light, $global-link-color, $single-link-color);
.dark-theme & {
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 & {
color: if($dark, $global-link-hover-color-dark, $single-link-hover-color-dark);
}
}
}
}

View file

@ -90,21 +90,7 @@
}
}
a {
color: $global-link-color;
.dark-theme & {
color: $global-link-color-dark;
}
&:hover {
color: $global-link-hover-color;
.dark-theme & {
color: $global-link-hover-color-dark;
}
}
}
@include link(true, true);
b, strong {
.dark-theme & {
@ -120,40 +106,12 @@
align-items: center;
font-size: .875rem;
a {
color: $single-link-color;
.dark-theme & {
color: $single-link-color-dark;
}
&:hover {
color: $single-link-hover-color;
.dark-theme & {
color: $single-link-hover-color-dark;
}
}
}
@include link(false, false);
.post-tags {
padding: 0;
a {
color: $global-link-color;
.dark-theme & {
color: $global-link-color-dark;
}
&:hover {
color: $global-link-hover-color;
.dark-theme & {
color: $global-link-hover-color-dark;
}
}
}
@include link(true, true);
}
}
}

View file

@ -1,6 +1,4 @@
/** Home **/
@import "../_partial/_home/summary";
@mixin page-home($profile, $posts) {
.home {
@if $profile {

View file

@ -26,21 +26,7 @@
color: $global-font-secondary-color-dark;
}
a {
color: $single-link-color;
.dark-theme & {
color: $global-link-color-dark;
}
&:hover {
color: $single-link-hover-color;
.dark-theme & {
color: $global-link-hover-color-dark;
}
}
}
@include link(false, true);
.author {
font-size: 1.05rem;
@ -102,23 +88,20 @@
}
}
@include link(false, false);
a {
word-break: break-all;
word-break: break-word;
color: $single-link-color;
.dark-theme &, .dark-theme & b, .dark-theme & strong {
.dark-theme & b, .dark-theme & strong {
color: $single-link-color-dark;
}
}
a:hover {
color: $single-link-hover-color;
.dark-theme &, .dark-theme & b, .dark-theme & strong {
.dark-theme a:hover b, .dark-theme a:hover strong {
color: $single-link-hover-color-dark;
}
}
ul {
padding-left: 2rem;

View file

@ -1,6 +1,8 @@
.tag-cloud-tags {
margin: 10px 0;
@include link(true, true);
a {
display: inline-block;
position: relative;
@ -14,23 +16,18 @@
&:active,
&:focus,
&:hover {
color: $global-link-hover-color;
-webkit-transform: scale(1.2);
-moz-transform: scale(1.2);
-ms-transform: scale(1.2);
-o-transform: scale(1.2);
transform: scale(1.2);
.dark-theme & {
color: $global-link-hover-color-dark;
}
}
small {
color: $global-font-secondary-color;
.dark-theme & {
color: $global-link-hover-color-dark;
color: $global-font-secondary-color-dark;
}
}
}

View file

@ -46,23 +46,12 @@ code, pre, .highlight table, .highlight tr, .highlight td {
}
}
.ln {
padding-right: .8rem;
}
.lntd {
&:first-child {
width: 1.2rem;
/* LineNumbersTable */
.lnt {
color: $code-info-color;
}
/* LineHighlight */
.hl {
font-weight: bolder;
}
}
&:last-child {
/* LineHighlight */
.hl {
display: block;
background-color: darken($code-background-color, 5%);
@ -73,6 +62,14 @@ code, pre, .highlight table, .highlight tr, .highlight td {
}
}
}
.ln, .lnt {
color: $global-font-secondary-color;
.dark-theme & {
color: $global-font-secondary-color-dark;
}
}
}
.highlight {
@ -103,6 +100,7 @@ code, pre, .highlight table, .highlight tr, .highlight td {
table, tr, td {
margin: 0;
border: none !important;
white-space: nowrap;
}
td {
@ -119,21 +117,7 @@ code, pre, .highlight table, .highlight tr, .highlight td {
padding: .4rem .8rem;
background-color: darken($code-background-color, 5%);
a {
color: $single-link-color;
.dark-theme & {
color: $single-link-color-dark;
}
}
a:hover {
color: $single-link-hover-color;
.dark-theme &:hover {
color: $single-link-hover-color-dark;
}
}
@include link(false, false);
.dark-theme & {
background-color: darken($code-background-color-dark, 5%);

View file

@ -21,21 +21,7 @@
color: $global-font-secondary-color-dark;
}
a {
color: $single-link-color;
.dark-theme & {
color: $single-link-color-dark;
}
&:hover {
color: $single-link-hover-color;
.dark-theme & {
color: $single-link-hover-color-dark;
}
}
}
@include link(false, false);
}
.post-info-license {
@ -51,21 +37,7 @@
font-size: 0.8rem;
width: 8rem;
a {
color: $single-link-color;
.dark-theme & {
color: $single-link-color-dark;
}
&:hover {
color: $single-link-hover-color;
.dark-theme & {
color: $single-link-hover-color-dark;
}
}
}
@include link(false, false);
}
}
}

View file

@ -11,6 +11,8 @@ $header-normal-mode-mobile: {{ if eq .Site.Params.header.mobileMode "normal" }}t
@import "_override";
{{- end -}}
@import "_mixin/index";
@import "_core/normalize";
@import "_core/base";
@import "_core/layout";

View file

@ -835,12 +835,11 @@ enableEmoji = true
[markup.highlight]
codeFences = true
guessSyntax = true
lineNoStart = 1
lineNos = true
lineNumbersInTable = true
lineNumbersInTable = false
# false is a necessary configuration (https://github.com/dillonzq/LoveIt/issues/158)
# false 是必要的设置 (https://github.com/dillonzq/LoveIt/issues/158)
noClasses = false
style = "monokai"
tabWidth = 4
# Goldmark is from Hugo 0.60 the default library used for Markdown
# Goldmark 是 Hugo 0.60 以来的默认 Markdown 解析库
[markup.goldmark]

View file

@ -3,6 +3,6 @@
// 覆盖变量
// ==============================
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@800&display=swap');
$header-title-font-family: 'Baloo 2', $global-font-family;
$header-title-font-family: 'Nunito', $global-font-family;

View file

@ -641,7 +641,7 @@ The rendered output looks like this:
| ext | extension to be used for dest files. |
{{< /admonition >}}
## 11 Links
## 11 Links {#links}
### Basic Link

View file

@ -648,7 +648,7 @@ The rendered output looks like this:
## 11 Links
### Basic Link
### Basic Link {#links}
```markdown
<https://assemble.io>

View file

@ -643,7 +643,7 @@ grunt.initConfig({
| ext | extension to be used for dest files. |
{{< /admonition >}}
## 11 链接
## 11 链接 {#links}
### 基本链接

View file

@ -205,7 +205,7 @@ Note that some of these parameters are explained in details in other sections of
# ICP info only in China (HTML format is allowed)
icp = ""
# license info (HTML format is allowed)
license= '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
license = '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
# Home Page Info
[params.home]
# Home Page Profile
@ -304,7 +304,7 @@ Note that some of these parameters are explained in details in other sections of
lightgallery = true
# whether to show link to Raw Markdown content of the post
linkToMarkdown = true
# mathematical formulas (KaTeX https://katex.org/)
# {{< link "https://katex.org/" KaTeX >}} mathematical formulas
[params.math]
enable = true
# default block delimiter is $$ ... $$ and \\[ ... \\]
@ -350,13 +350,13 @@ Note that some of these parameters are explained in details in other sections of
# Comment Config
[params.comment]
enable = true
# Disqus Comment Config (https://disqus.com/)
# {{< link "https://disqus.com/" Disqus >}} Comment Config
[params.comment.disqus]
# {{< version 0.1.1 >}}
enable = false
# Disqus shortname to use Disqus in posts
shortname = ""
# Gitalk Comment Config (https://github.com/gitalk/gitalk)
# {{< link "https://github.com/gitalk/gitalk" Gitalk >}} Comment Config
[params.comment.gitalk]
# {{< version 0.1.1 >}}
enable = false
@ -364,7 +364,7 @@ Note that some of these parameters are explained in details in other sections of
repo = ""
clientId = ""
clientSecret = ""
# Valine Comment Config (https://github.com/xCss/Valine)
# {{< link "https://github.com/xCss/Valine" Valine >}} Comment Config
[params.comment.valine]
enable = false
appId = ""
@ -378,7 +378,7 @@ Note that some of these parameters are explained in details in other sections of
lang = "en"
visitor = true
recordIP = true
# Facebook Comment Config (https://developers.facebook.com/docs/plugins/comments)
# {{< link "https://developers.facebook.com/docs/plugins/comments" "Facebook Comment" >}} Config
[params.comment.facebook]
enable = false
width = "100%"
@ -412,58 +412,57 @@ Note that some of these parameters are explained in details in other sections of
height = 600
# CSS and JS Files CDN
[params.cdn]
# fontawesome-free@5.12.1 https://fontawesome.com/
# {{< link "https://fontawesome.com/" "fontawesome-free" >}}@5.12.1
fontawesomeFreeCSS = ''
# animate.css@3.7.2 https://github.com/daneden/animate.css
animateCSS = ''
# smooth-scroll@16.1.2 https://github.com/cferdinandi/smooth-scroll
# {{< link "https://github.com/cferdinandi/smooth-scroll" "smooth-scroll" >}}@16.1.2
smoothScrollJS = ''
# sharer@0.4.0 https://github.com/ellisonleao/sharer.js
# {{< link "https://github.com/ellisonleao/sharer.js" "sharer" >}}@0.4.0
sharerJS = ''
# lazysizes@5.2.0 https://github.com/aFarkas/lazysizes
# {{< link "https://github.com/aFarkas/lazysizes" "lazysizes" >}}@5.2.0
lazysizesJS = ''
# lightgallery@1.1.3 lg-thumbnail@1.1.0 lg-zoom@1.1.0 https://github.com/sachinchoolur/lightgallery.js
# {{< link "https://github.com/sachinchoolur/lightgallery.js" "lightgallery" >}}@1.1.3 lg-thumbnail@1.1.0 lg-zoom@1.1.0
lightgalleryCSS = ''
lightgalleryJS = ''
lightgalleryThumbnailJS = ''
lightgalleryZoomJS = ''
# typeit@6.5.1 https://github.com/alexmacarthur/typeit
# {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@6.5.1
typeitJS = ''
# katex@0.11.1 https://github.com/KaTeX/KaTeX
# {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1
katexCSS = ''
katexJS = ''
katexAutoRenderJS = ''
katexCopyTexCSS = ''
katexCopyTexJS = ''
katexMhchemJS = ''
# mermaid@8.4.8 https://github.com/knsv/mermaid
# {{< link "https://github.com/knsv/mermaid" "mermaid" >}}@8.4.8
mermaidJS = ''
# aplayer@1.10.1 https://github.com/MoePlayer/APlayer
# {{< link "https://github.com/MoePlayer/APlayer" "aplayer" >}}@1.10.1
aplayerCSS = ''
aplayerJS = ''
# meting@2.0.1 https://github.com/metowolf/MetingJS
# {{< link "https://github.com/metowolf/MetingJS" "meting" >}}@2.0.1
metingJS = ''
# echarts@4.6.0 https://echarts.apache.org/
# {{< link "https://echarts.apache.org/" "echarts" >}}@4.6.0
echartsJS = ''
echartsMacaronsJS = ''
# gitalk@1.6.2 https://github.com/gitalk/gitalk
# {{< link "https://github.com/gitalk/gitalk" "gitalk" >}}@1.6.2
gitalkCSS = ''
gitalkJS = ''
# valine@1.3.10 https://valine.js.org/
# {{< link "https://valine.js.org/" "valine" >}}@1.3.10
valineJS = ''
# Markup related configuration in Hugo
[markup]
# Syntax Highlighting (https://gohugo.io/content-management/syntax-highlighting)
# {{< link "https://gohugo.io/content-management/syntax-highlighting" "Syntax Highlighting" >}}
[markup.highlight]
codeFences = true
guessSyntax = true
lineNoStart = 1
lineNos = true
lineNumbersInTable = true
lineNumbersInTable = false
# false is a necessary configuration
# ({{< link "https://github.com/dillonzq/LoveIt/issues/158" >}})
noClasses = false
style = "monokai"
tabWidth = 4
# Goldmark is from Hugo 0.60 the default library used for Markdown
[markup.goldmark]
[markup.goldmark.extensions]
@ -493,12 +492,12 @@ Note that some of these parameters are explained in details in other sections of
filename = "sitemap.xml"
priority = 0.5
# Permalinks Info (https://gohugo.io/content-management/urls/#permalinks)
# {{< link "https://gohugo.io/content-management/urls/#permalinks" "Permalinks Info" >}}
[Permalinks]
# posts = ":year/:month/:filename"
posts = ":filename"
# Privacy Info (https://gohugo.io/about/hugo-and-gdpr/)
# {{< link "https://gohugo.io/about/hugo-and-gdpr/" "Privacy Info" >}}
[privacy]
[privacy.googleAnalytics]
anonymizeIP = true

View file

@ -31,6 +31,11 @@ Découvrez en quoi consiste le thème Hugo - **LoveIt** et les concepts fondamen
<!--more-->
{{< admonition warning >}}
Sorry, this article has not been completely translated into **French**.
Welcome to take the time to propose a translation by [making a PR](https://github.com/dillonzq/LoveIt/pulls) to the theme!
{{< /admonition >}}
## 1 Requirements
Thanks to the simplicity of Hugo, [Hugo](https://gohugo.io/) is the only dependency of this theme.
@ -205,7 +210,7 @@ Note that some of these parameters are explained in details in other sections of
# ICP info only in China (HTML format is allowed)
icp = ""
# license info (HTML format is allowed)
license= '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
license = '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
# Home Page Info
[params.home]
# Home Page Profile
@ -304,7 +309,7 @@ Note that some of these parameters are explained in details in other sections of
lightgallery = true
# whether to show link to Raw Markdown content of the post
linkToMarkdown = true
# mathematical formulas (KaTeX https://katex.org/)
# {{< link "https://katex.org/" KaTeX >}} mathematical formulas
[params.math]
enable = true
# default block delimiter is $$ ... $$ and \\[ ... \\]
@ -350,13 +355,13 @@ Note that some of these parameters are explained in details in other sections of
# Comment Config
[params.comment]
enable = true
# Disqus Comment Config (https://disqus.com/)
# {{< link "https://disqus.com/" Disqus >}} Comment Config
[params.comment.disqus]
# {{< version 0.1.1 >}}
enable = false
# Disqus shortname to use Disqus in posts
shortname = ""
# Gitalk Comment Config (https://github.com/gitalk/gitalk)
# {{< link "https://github.com/gitalk/gitalk" Gitalk >}} Comment Config
[params.comment.gitalk]
# {{< version 0.1.1 >}}
enable = false
@ -364,7 +369,7 @@ Note that some of these parameters are explained in details in other sections of
repo = ""
clientId = ""
clientSecret = ""
# Valine Comment Config (https://github.com/xCss/Valine)
# {{< link "https://github.com/xCss/Valine" Valine >}} Comment Config
[params.comment.valine]
enable = false
appId = ""
@ -378,7 +383,7 @@ Note that some of these parameters are explained in details in other sections of
lang = "en"
visitor = true
recordIP = true
# Facebook Comment Config (https://developers.facebook.com/docs/plugins/comments)
# {{< link "https://developers.facebook.com/docs/plugins/comments" "Facebook Comment" >}} Config
[params.comment.facebook]
enable = false
width = "100%"
@ -412,58 +417,57 @@ Note that some of these parameters are explained in details in other sections of
height = 600
# CSS and JS Files CDN
[params.cdn]
# fontawesome-free@5.12.1 https://fontawesome.com/
# {{< link "https://fontawesome.com/" "fontawesome-free" >}}@5.12.1
fontawesomeFreeCSS = ''
# animate.css@3.7.2 https://github.com/daneden/animate.css
animateCSS = ''
# smooth-scroll@16.1.2 https://github.com/cferdinandi/smooth-scroll
# {{< link "https://github.com/cferdinandi/smooth-scroll" "smooth-scroll" >}}@16.1.2
smoothScrollJS = ''
# sharer@0.4.0 https://github.com/ellisonleao/sharer.js
# {{< link "https://github.com/ellisonleao/sharer.js" "sharer" >}}@0.4.0
sharerJS = ''
# lazysizes@5.2.0 https://github.com/aFarkas/lazysizes
# {{< link "https://github.com/aFarkas/lazysizes" "lazysizes" >}}@5.2.0
lazysizesJS = ''
# lightgallery@1.1.3 lg-thumbnail@1.1.0 lg-zoom@1.1.0 https://github.com/sachinchoolur/lightgallery.js
# {{< link "https://github.com/sachinchoolur/lightgallery.js" "lightgallery" >}}@1.1.3 lg-thumbnail@1.1.0 lg-zoom@1.1.0
lightgalleryCSS = ''
lightgalleryJS = ''
lightgalleryThumbnailJS = ''
lightgalleryZoomJS = ''
# typeit@6.5.1 https://github.com/alexmacarthur/typeit
# {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@6.5.1
typeitJS = ''
# katex@0.11.1 https://github.com/KaTeX/KaTeX
# {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1
katexCSS = ''
katexJS = ''
katexAutoRenderJS = ''
katexCopyTexCSS = ''
katexCopyTexJS = ''
katexMhchemJS = ''
# mermaid@8.4.8 https://github.com/knsv/mermaid
# {{< link "https://github.com/knsv/mermaid" "mermaid" >}}@8.4.8
mermaidJS = ''
# aplayer@1.10.1 https://github.com/MoePlayer/APlayer
# {{< link "https://github.com/MoePlayer/APlayer" "aplayer" >}}@1.10.1
aplayerCSS = ''
aplayerJS = ''
# meting@2.0.1 https://github.com/metowolf/MetingJS
# {{< link "https://github.com/metowolf/MetingJS" "meting" >}}@2.0.1
metingJS = ''
# echarts@4.6.0 https://echarts.apache.org/
# {{< link "https://echarts.apache.org/" "echarts" >}}@4.6.0
echartsJS = ''
echartsMacaronsJS = ''
# gitalk@1.6.2 https://github.com/gitalk/gitalk
# {{< link "https://github.com/gitalk/gitalk" "gitalk" >}}@1.6.2
gitalkCSS = ''
gitalkJS = ''
# valine@1.3.10 https://valine.js.org/
# {{< link "https://valine.js.org/" "valine" >}}@1.3.10
valineJS = ''
# Markup related configuration in Hugo
[markup]
# Syntax Highlighting (https://gohugo.io/content-management/syntax-highlighting)
# {{< link "https://gohugo.io/content-management/syntax-highlighting" "Syntax Highlighting" >}}
[markup.highlight]
codeFences = true
guessSyntax = true
lineNoStart = 1
lineNos = true
lineNumbersInTable = true
lineNumbersInTable = false
# false is a necessary configuration
# ({{< link "https://github.com/dillonzq/LoveIt/issues/158" >}})
noClasses = false
style = "monokai"
tabWidth = 4
# Goldmark is from Hugo 0.60 the default library used for Markdown
[markup.goldmark]
[markup.goldmark.extensions]
@ -493,12 +497,12 @@ Note that some of these parameters are explained in details in other sections of
filename = "sitemap.xml"
priority = 0.5
# Permalinks Info (https://gohugo.io/content-management/urls/#permalinks)
# {{< link "https://gohugo.io/content-management/urls/#permalinks" "Permalinks Info" >}}
[Permalinks]
# posts = ":year/:month/:filename"
posts = ":filename"
# Privacy Info (https://gohugo.io/about/hugo-and-gdpr/)
# {{< link "https://gohugo.io/about/hugo-and-gdpr/" "Privacy Info" >}}
[privacy]
[privacy.googleAnalytics]
anonymizeIP = true

View file

@ -208,7 +208,7 @@ hugo
# ICP 备案信息,仅在中国使用 (允许使用 HTML 格式)
icp = ""
# 许可协议信息 (允许使用 HTML 格式)
license= '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
license = '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
# 文章页面配置
[params.home]
# 主页信息设置
@ -306,7 +306,7 @@ hugo
lightgallery = true
# 是否在文章页面显示原始 Markdown 文档链接
linkToMarkdown = true
# 数学公式 (KaTeX https://katex.org/)
# {{< link "https://katex.org/" KaTeX >}} 数学公式
[params.math]
enable = true
# 默认块定界符是 $$ ... $$ 和 \\[ ... \\]
@ -352,13 +352,13 @@ hugo
# 评论系统设置
[params.comment]
enable = true
# Disqus 评论系统设置 (https://disqus.com/)
# {{< link "https://disqus.com/" Disqus >}} 评论系统设置
[params.comment.disqus]
# {{< version 0.1.1 >}}
enable = false
# Disqus 的 shortname用来在文章中启用 Disqus 评论系统
shortname = ""
# Gitalk 评论系统设置 (https://github.com/gitalk/gitalk)
# {{< link "https://github.com/gitalk/gitalk" Gitalk >}} 评论系统设置
[params.comment.gitalk]
# {{< version 0.1.1 >}}
enable = false
@ -366,7 +366,7 @@ hugo
repo = ""
clientId = ""
clientSecret = ""
# Valine 评论系统设置 (https://github.com/xCss/Valine)
# {{< link "https://github.com/xCss/Valine" Valine >}} 评论系统设置
[params.comment.valine]
enable = false
appId = ""
@ -380,7 +380,7 @@ hugo
lang = "en"
visitor = true
recordIP = true
# Facebook 评论系统设置 (https://developers.facebook.com/docs/plugins/comments)
# # {{< link "https://developers.facebook.com/docs/plugins/comments" "Facebook 评论系统" >}}设置
[params.comment.facebook]
enable = false
width = "100%"
@ -414,58 +414,57 @@ hugo
height = 600
# CSS 和 JS 文件的 CDN 设置
[params.cdn]
# fontawesome-free@5.12.1 https://fontawesome.com/
# {{< link "https://fontawesome.com/" "fontawesome-free" >}}@5.12.1
fontawesomeFreeCSS = ''
# animate.css@3.7.2 https://github.com/daneden/animate.css
animateCSS = ''
# smooth-scroll@16.1.2 https://github.com/cferdinandi/smooth-scroll
# {{< link "https://github.com/cferdinandi/smooth-scroll" "smooth-scroll" >}}@16.1.2
smoothScrollJS = ''
# sharer@0.4.0 https://github.com/ellisonleao/sharer.js
# {{< link "https://github.com/ellisonleao/sharer.js" "sharer" >}}@0.4.0
sharerJS = ''
# lazysizes@5.2.0 https://github.com/aFarkas/lazysizes
# {{< link "https://github.com/aFarkas/lazysizes" "lazysizes" >}}@5.2.0
lazysizesJS = ''
# lightgallery@1.1.3 lg-thumbnail@1.1.0 lg-zoom@1.1.0 https://github.com/sachinchoolur/lightgallery.js
# {{< link "https://github.com/sachinchoolur/lightgallery.js" "lightgallery" >}}@1.1.3 lg-thumbnail@1.1.0 lg-zoom@1.1.0
lightgalleryCSS = ''
lightgalleryJS = ''
lightgalleryThumbnailJS = ''
lightgalleryZoomJS = ''
# typeit@6.5.1 https://github.com/alexmacarthur/typeit
# {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@6.5.1
typeitJS = ''
# katex@0.11.1 https://github.com/KaTeX/KaTeX
# {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1
katexCSS = ''
katexJS = ''
katexAutoRenderJS = ''
katexCopyTexCSS = ''
katexCopyTexJS = ''
katexMhchemJS = ''
# mermaid@8.4.8 https://github.com/knsv/mermaid
# {{< link "https://github.com/knsv/mermaid" "mermaid" >}}@8.4.8
mermaidJS = ''
# aplayer@1.10.1 https://github.com/MoePlayer/APlayer
# {{< link "https://github.com/MoePlayer/APlayer" "aplayer" >}}@1.10.1
aplayerCSS = ''
aplayerJS = ''
# meting@2.0.1 https://github.com/metowolf/MetingJS
# {{< link "https://github.com/metowolf/MetingJS" "meting" >}}@2.0.1
metingJS = ''
# echarts@4.6.0 https://echarts.apache.org/
# {{< link "https://echarts.apache.org/" "echarts" >}}@4.6.0
echartsJS = ''
echartsMacaronsJS = ''
# gitalk@1.6.2 https://github.com/gitalk/gitalk
# {{< link "https://github.com/gitalk/gitalk" "gitalk" >}}@1.6.2
gitalkCSS = ''
gitalkJS = ''
# valine@1.3.10 https://valine.js.org/
# {{< link "https://valine.js.org/" "valine" >}}@1.3.10
valineJS = ''
# Hugo 解析文档的配置
[markup]
# 语法高亮设置 (https://gohugo.io/content-management/syntax-highlighting)
# {{< link "https://gohugo.io/content-management/syntax-highlighting" "语法高亮设置" >}}
[markup.highlight]
codeFences = true
guessSyntax = true
lineNoStart = 1
lineNos = true
lineNumbersInTable = true
lineNumbersInTable = false
# false 是必要的设置
# ({{< link "https://github.com/dillonzq/LoveIt/issues/158" >}})
noClasses = false
style = "monokai"
tabWidth = 4
# Goldmark 是 Hugo 0.60 以来的默认 Markdown 解析库
[markup.goldmark]
[markup.goldmark.extensions]
@ -495,12 +494,12 @@ hugo
filename = "sitemap.xml"
priority = 0.5
# Permalinks 信息 (https://gohugo.io/content-management/urls/#permalinks)
# {{< link "https://gohugo.io/content-management/urls/#permalinks" "Permalinks 信息" >}}
[Permalinks]
# posts = ":year/:month/:filename"
posts = ":filename"
# 隐私信息设置 (https://gohugo.io/about/hugo-and-gdpr/)
# {{< link "https://gohugo.io/about/hugo-and-gdpr/" "隐私信息设置" >}}
[privacy]
[privacy.googleAnalytics]
anonymizeIP = true

View file

@ -31,6 +31,11 @@ Découvrez comment créer et organiser votre contenu rapidement et intuitivement
<!--more-->
{{< admonition warning >}}
Sorry, this article has not been completely translated into **French**.
Welcome to take the time to propose a translation by [making a PR](https://github.com/dillonzq/LoveIt/pulls) to the theme!
{{< /admonition >}}
## 1 Contents Organization
A few suggestions to help you get a good looking site quickly:

View file

@ -217,6 +217,72 @@ The rendered output looks like this:
This is a right-aligned paragraph.
{{< /style >}}
### `link`
{{< admonition >}}
{{< version 1.2.0 >}}
{{< /admonition >}}
`link` shortcode is an alternative to [Markdown link syntax](../basic-markdown-syntax/#links). `link` shortcode can provide some other features and can be used in code blocks.
The `link` shortcode can use the following named parameters:
* **href**
Destination of the link.
* **content**
Content of the link (HTML format is allowed).
* **title**
`title` attribute of the HTML `a` tag, which will be shown when hovering on the link.
* **rel**
Additional `rel` attributes of the HTML `a` tag.
* **class**
`class` attribute of the HTML `a` tag.
#### Basic `link`
Example basic `link` Input:
```markdown
{{</* link "https://assemble.io" */>}}
Or
{{</* link href="https://assemble.io" */>}}
{{</* link "mailto:contact@revolunet.com" */>}}
Or
{{</* link href="mailto:contact@revolunet.com" */>}}
{{</* link "https://assemble.io" Assemble */>}}
Or
{{</* link href="https://assemble.io" content=Assemble */>}}
```
The rendered output looks like this:
* {{< link "https://assemble.io" >}}
* {{< link "mailto:contact@revolunet.com" >}}
* {{< link "https://assemble.io" Assemble >}}
#### Add a Title
```markdown
{{</* link "https://github.com/upstage/" Upstage "Visit Upstage!" */>}}
Or
{{</* link href="https://github.com/upstage/" content=Upstage title="Visit Upstage!" */>}}
```
The rendered output looks like this (hover over the link, there should be a tooltip):
{{< link "https://github.com/upstage/" Upstage "Visit Upstage!" >}}
### `image`
`image` shortcode is an alternative to [`figure` shortcode](#figure). `image` shortcode can take full advantage of the dependent libraries of [lazysizes](https://github.com/aFarkas/lazysizes) and [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js).

View file

@ -222,6 +222,72 @@ The rendered output looks like this:
This is a right-aligned paragraph.
{{< /style >}}
### `link`
{{< admonition >}}
{{< version 1.2.0 >}}
{{< /admonition >}}
`link` shortcode is an alternative to [Markdown link syntax](../basic-markdown-syntax/#links). `link` shortcode can provide some other features and can be used in code blocks.
The `link` shortcode can use the following named parameters:
* **href**
Destination of the link.
* **content**
Content of the link (HTML format is allowed).
* **title**
`title` attribute of the HTML `a` tag, which will be shown when hovering on the link.
* **rel**
Additional `rel` attributes of the HTML `a` tag.
* **class**
`class` attribute of the HTML `a` tag.
#### Basic `link`
Example basic `link` Input:
```markdown
{{</* link "https://assemble.io" */>}}
Or
{{</* link href="https://assemble.io" */>}}
{{</* link "mailto:contact@revolunet.com" */>}}
Or
{{</* link href="mailto:contact@revolunet.com" */>}}
{{</* link "https://assemble.io" Assemble */>}}
Or
{{</* link href="https://assemble.io" content=Assemble */>}}
```
The rendered output looks like this:
* {{< link "https://assemble.io" >}}
* {{< link "mailto:contact@revolunet.com" >}}
* {{< link "https://assemble.io" Assemble >}}
#### Add a Title
```markdown
{{</* link "https://github.com/upstage/" Upstage "Visit Upstage!" */>}}
Or
{{</* link href="https://github.com/upstage/" content=Upstage title="Visit Upstage!" */>}}
```
The rendered output looks like this (hover over the link, there should be a tooltip):
{{< link "https://github.com/upstage/" Upstage "Visit Upstage!" >}}
### `image`
`image` shortcode is an alternative to [`figure` shortcode](#figure). `image` shortcode can take full advantage of the dependent libraries of [lazysizes](https://github.com/aFarkas/lazysizes) and [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js).

View file

@ -219,6 +219,73 @@ This is a right-aligned paragraph.
This is a right-aligned paragraph.
{{< /style >}}
### `link`
{{< admonition >}}
{{< version 1.2.0 >}}
{{< /admonition >}}
`link` shortcode 是 [Markdown 链接语法](../basic-markdown-syntax/#links) 的替代.
`link` shortcode 可以提供一些其它的功能并且可以在代码块中使用.
`link` shortcode 可以使用以下命名参数:
* **href**
链接的目标.
* **content**
链接的内容 (允许 HTML 格式).
* **title**
HTML `a` 标签 的 `title` 属性, 当悬停在链接上会显示的提示.
* **rel**
HTML `a` 标签 的 `rel` 补充属性.
* **class**
HTML `a` 标签 的 `class` 属性.
#### 基本 `link`
一个基本的 `link` 示例:
```markdown
{{</* link "https://assemble.io" */>}}
或者
{{</* link href="https://assemble.io" */>}}
{{</* link "mailto:contact@revolunet.com" */>}}
或者
{{</* link href="mailto:contact@revolunet.com" */>}}
{{</* link "https://assemble.io" Assemble */>}}
或者
{{</* link href="https://assemble.io" content=Assemble */>}}
```
呈现的输出效果如下:
* {{< link "https://assemble.io" >}}
* {{< link "mailto:contact@revolunet.com" >}}
* {{< link "https://assemble.io" Assemble >}}
#### 添加一个标题
```markdown
{{</* link "https://github.com/upstage/" Upstage "Visit Upstage!" */>}}
或者
{{</* link href="https://github.com/upstage/" content=Upstage title="Visit Upstage!" */>}}
```
呈现的输出效果如下 (将鼠标悬停在链接上,会有一行提示):
{{< link "https://github.com/upstage/" Upstage "Visit Upstage!" >}}
### `image`
`image` shortcode 是 [`figure` shortcode](#figure) 的替代. `image` shortcode 可以充分利用 [lazysizes](https://github.com/aFarkas/lazysizes) 和 [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js) 两个依赖库.
@ -333,7 +400,7 @@ This is a right-aligned paragraph.
{{</* admonition type=tip title="This is a tip" details=true */>}}
一个 **技巧** 横幅
{{</* /admonition */>}}
Or
或者
{{</* admonition tip "This is a tip" true */>}}
一个 **技巧** 横幅
{{</* /admonition */>}}
@ -1016,7 +1083,7 @@ data = [
```markdown
{{</* music auto="https://music.163.com/#/playlist?id=60198" */>}}
Or
或者
{{</* music "https://music.163.com/#/playlist?id=60198" */>}}
```
@ -1030,7 +1097,7 @@ Or
```markdown
{{</* music server="netease" type="song" id="1868553" */>}}
Or
或者
{{</* music netease song 1868553 */>}}
```
@ -1052,7 +1119,7 @@ https://www.bilibili.com/video/av47027633
```markdown
{{</* bilibili 47027633 */>}}
Or
或者
{{</* bilibili av=47027633 */>}}
```
@ -1070,7 +1137,7 @@ https://www.bilibili.com/video/av36570401?p=3
```markdown
{{</* bilibili 36570401 3 */>}}
Or
或者
{{</* bilibili av=36570401 p=3 */>}}
```

View file

@ -19,8 +19,8 @@
{{- $author := .Params.author | default .Site.Author.name | default (T "author") -}}
{{- $authorLink := .Params.authorLink | default .Site.Author.link | default (relLangURL "/") -}}
<span class="post-author">
{{- $link := dict "class" "author" "href" $authorLink "title" "Author" "rel" "author" "icon" (dict "class" "fas fa-user-circle fa-fw") "content" $author -}}
{{- partial "plugin/link.html" $link -}}
{{- $options := dict "class" "author" "href" $authorLink "title" "Author" "rel" "author" "icon" (dict "class" "fas fa-user-circle fa-fw") "content" $author -}}
{{- partial "plugin/link.html" $options -}}
</span>
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}

View file

@ -1,4 +1,5 @@
<a href="{{ .href | safeURL }}"{{ with .title }} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .href "http" }} target="_blank"{{ end }} rel="noopener noreffer{{ with .rel }} {{ . }}{{ end }}"{{ with .class }} class="{{ . }}"{{ end }}>
{{- $rel := "" -}}
<a href="{{ .href | safeURL }}"{{ with .title }} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .href "http" }}{{ $rel = "noopener noreffer" }} target="_blank"{{ end }} rel="{{ $rel }}{{ with .rel }} {{ . }}{{ end }}"{{ with .class }} class="{{ . }}"{{ end }}>
{{- with .icon -}}
{{- partial "plugin/icon.html" . -}}
{{- end -}}

View file

@ -15,8 +15,8 @@
{{- $author := .Params.author | default .Site.Author.name | default (T "author") -}}
{{- $authorLink := .Params.authorLink | default .Site.Author.link | default (relLangURL "/") -}}
<span class="post-author">
{{- $link := dict "class" "author" "href" $authorLink "title" "Author" "rel" "author" "icon" (dict "class" "fas fa-user-circle fa-fw") "content" $author -}}
{{- partial "plugin/link.html" $link -}}
{{- $options := dict "class" "author" "href" $authorLink "title" "Author" "rel" "author" "icon" (dict "class" "fas fa-user-circle fa-fw") "content" $author -}}
{{- partial "plugin/link.html" $options -}}
</span>
{{- with .Params.categories -}}

View file

@ -0,0 +1,13 @@
{{- $options := dict -}}
{{- if .IsNamedParams -}}
{{- $options = dict "href" (.Get "href") | merge $options -}}
{{- $options = dict "title" (.Get "title") | merge $options -}}
{{- $options = dict "rel" (.Get "rel") | merge $options -}}
{{- $options = dict "class" (.Get "class") | merge $options -}}
{{- $options = dict "content" (.Get "content") | merge $options -}}
{{- else -}}
{{- $options = dict "href" (.Get 0) | merge $options -}}
{{- $options = dict "content" (.Get 1 | default (.Get 0)) | merge $options -}}
{{- $options = dict "title" (.Get 2) | merge $options -}}
{{- end -}}
{{- partial "plugin/link.html" $options -}}

View file

@ -15,6 +15,7 @@
"scripts": {
"build": "npx babel src --out-file assets/js/theme.min.js --source-maps && hugo -v --source=exampleSite --themesDir=../.. -D --gc",
"start": "npm run build && hugo server --source=exampleSite --themesDir=../.. --disableFastRender",
"check": "htmlproofer exampleSite/public --check-html --allow-hash-href --empty-alt-ignore --disable-external",
"copy": "rm -rf resources && cp -rf exampleSite/resources resources"
},
"husky": {