-
- Click to view features
-
-
+ Click to expand/close details
+
- - Dark / Light Theme Mode
- - Localized UI language
- - Pinned Posts on Home Page
- - Hierarchical Categories
- - Trending Tags
- - Table of Contents
- - Last Modified Date
- - Syntax Highlighting
- - Mathematical Expressions
- - Mermaid Diagrams & Flowcharts
- - Dark / Light Mode Images
- - Embed Videos
- - Disqus / Utterances / Giscus Comments
- - Built-in Search
- - Atom Feeds
- - PWA
- - Google Analytics
- - SEO & Performance Optimization
+- Dark / Light Theme Mode
+- Localized UI language
+- Pinned Posts on Home Page
+- Hierarchical Categories
+- Trending Tags
+- Table of Contents
+- Last Modified Date
+- Syntax Highlighting
+- Mathematical Expressions
+- Mermaid Diagrams & Flowcharts
+- Dark / Light Mode Images
+- Embed Videos
+- Disqus / Giscus / Utterances Comments
+- Built-in Search
+- Atom Feeds
+- PWA
+- Google Analytics
+- SEO & Performance Optimization
-
## Documentation
-To explore usage, development, and upgrade guide of the project, please refer to the [**Wiki**][wiki].
+To learn how to use, develop, and upgrade the project, please refer to the [Wiki][wiki].
## Contributing
-Contributions (Issues/PRs/Discussions) are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. For details, see the "[Contributing Guidelines][contribute-guide]".
+Contributions (_pull requests_, _issues_, and _discussions_) are what make the open-source community such an amazing place
+to learn, inspire, and create. Any contributions you make are greatly appreciated.
+For details, see the "[Contributing Guidelines][contribute-guide]".
## Credits
-This theme is mainly built with [Jekyll][jekyllrb] ecosystem,
-[Bootstrap][bootstrap], [Font Awesome][icons] and some other [wonderful tools][lib].
+This project is mainly built with [Jekyll][jekyllrb] ecosystem,
+[Bootstrap][bootstrap], [Font Awesome][icons], and some other [wonderful tools][lib].
The avatar and favicon design come from [Clipart Max][image].
Many thanks to the [contributors][contributors] who participated in the development
@@ -67,15 +66,15 @@ Last but not least, thanks to [JetBrains][jetbrains] for providing the _Open Sou
## Sponsoring
-If you'd like to sponsor this project, the following options are available.
+If you like this project or have built something through it, please consider sponsoring it, and your support would be greatly appreciated.
[![Ko-fi](https://img.shields.io/badge/Support_Me_on_Ko--fi-ff5e5b?logo=ko-fi&logoColor=white)][ko-fi]
-[![Wechat Pay](https://img.shields.io/badge/Tip_Me_on_WeChat-brightgreen?logo=wechat&logoColor=white)][donation]
-[![Alipay](https://img.shields.io/badge/Tip_Me_on_Alipay-blue?logo=alipay&logoColor=white)][donation]
+[![Wechat Pay](https://img.shields.io/badge/Support_Me_on_WeChat-brightgreen?logo=wechat&logoColor=white)][donation]
+[![Alipay](https://img.shields.io/badge/Support_Me_on_Alipay-blue?logo=alipay&logoColor=white)][donation]
## License
-This work is published under [MIT License][license].
+This project is published under [MIT License][license].
[gem]: https://rubygems.org/gems/jekyll-theme-chirpy
[ci]: https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml?query=event%3Apush+branch%3Amaster
diff --git a/_config.yml b/_config.yml
index f7245f8..05044ca 100644
--- a/_config.yml
+++ b/_config.yml
@@ -3,10 +3,6 @@
# Import the theme
theme: jekyll-theme-chirpy
-# Change the following value to '/PROJECT_NAME' ONLY IF your site type is GitHub Pages Project sites
-# and doesn't have a custom domain.
-baseurl: ""
-
# The language of the webpage › http://www.lingoes.net/en/translator/langcode.htm
# If it has the same name as one of the files in folder `_data/locales`, the layout language will also be changed,
# otherwise, the layout language will use the default value of 'en'.
@@ -25,7 +21,8 @@ tagline: A text-focused Jekyll theme # it will display as the sub-title
description: >- # used by seo meta and the atom feed
A minimal, responsive and feature-rich Jekyll theme for technical writing.
-# fill in the protocol & hostname for your site, e.g., 'https://username.github.io'
+# Fill in the protocol & hostname for your site.
+# e.g. 'https://username.github.io', note that it does not end with a '/'.
url: ""
github:
@@ -114,6 +111,9 @@ pwa:
paginate: 10
+# The base URL of your site
+baseurl: ""
+
# ------------ The following options are not recommended to be modified ------------------
kramdown:
@@ -180,7 +180,6 @@ exclude:
- docs
- tools
- README.md
- - CHANGELOG.md
- LICENSE
- rollup.config.js
- package*.json
diff --git a/_data/locales/de-DE.yml b/_data/locales/de-DE.yml
index 7ea3956..6b187b4 100644
--- a/_data/locales/de-DE.yml
+++ b/_data/locales/de-DE.yml
@@ -58,7 +58,7 @@ post:
pageview_measure: Aufrufe
read_time:
unit: Minuten
- prompt: lesen
+ prompt: Lesezeit
relate_posts: Weiterlesen
share: Teilen
button:
@@ -70,6 +70,13 @@ post:
title: Link kopieren
succeed: Link erfolgreich kopiert!
+# Date time format.
+# See:
Comments powered by Disqus.
' + {% assign _new_content = _new_content + | append: _snippet + | append: ''
+ | append: _label
+ | append: ' '
+ | append: '
' %} - {% endif %} - {% endfor %} {% assign _content = _new_content %} - {% endif %} @@ -249,11 +230,11 @@ {% assign _heading_content = _content %} {% for level in heading_levels %} - {% capture mark_start %}' %}
{% if _heading_content contains mark_start %}
- {% assign _new_content = nil %}
+ {% assign _new_content = null %}
{% assign heading_snippets = _heading_content | split: mark_start %}
{% for snippet in heading_snippets %}
@@ -263,20 +244,19 @@
{% endif %}
{% assign id = snippet | split: '"' | first %}
- {% capture anchor %}{% endcapture %}
+ {% assign anchor = ''
+ %}
{% assign left = snippet | split: mark_end | first %}
{% assign right = snippet | slice: left.size, snippet.size %}
{% assign left = left | replace_first: '">', '">' | append: '' %}
- {% assign _new_content = _new_content | append: mark_start
- | append: left | append: anchor | append: right
- %}
-
+ {% assign _new_content = _new_content | append: mark_start | append: left | append: anchor | append: right %}
{% endfor %}
{% assign _heading_content = _new_content %}
-
{% endif %}
{% endfor %}
diff --git a/_includes/related-posts.html b/_includes/related-posts.html
index ebe98d0..1ba2f32 100644
--- a/_includes/related-posts.html
+++ b/_includes/related-posts.html
@@ -78,9 +78,9 @@
- {% include datetime.html date=post.date class="small" lang=include.lang %}
+ {% include datetime.html date=post.date lang=include.lang %}
+
{{ post.title }}
-{% include no-linenos.html content=post.content %} {{ content | markdownify | strip_html | truncate: 200 | escape }} diff --git a/_includes/toc.html b/_includes/toc.html index a9e48e9..604d2c1 100644 --- a/_includes/toc.html +++ b/_includes/toc.html @@ -6,7 +6,7 @@ {% endif %} {% if enable_toc %} -
+
diff --git a/_javascript/home.js b/_javascript/home.js
index 70af328..02948c9 100644
--- a/_javascript/home.js
+++ b/_javascript/home.js
@@ -1,8 +1,8 @@
import { basic, initSidebar, initTopbar } from './modules/layouts';
-import { initLocaleDatetime, imgLazy } from './modules/plugins';
+import { initLocaleDatetime, loadImg } from './modules/plugins';
basic();
initSidebar();
initTopbar();
initLocaleDatetime();
-imgLazy();
+loadImg();
diff --git a/_javascript/modules/components/clipboard.js b/_javascript/modules/components/clipboard.js
index f4634cf..68f6afd 100644
--- a/_javascript/modules/components/clipboard.js
+++ b/_javascript/modules/components/clipboard.js
@@ -126,6 +126,5 @@ export function initClipboard() {
btnCopyLink.on('mouseleave', function (e) {
const target = $(e.target);
target.tooltip('hide');
- console.log('mouse leave...');
});
}
diff --git a/_javascript/modules/components/img-lazyload.js b/_javascript/modules/components/img-lazyload.js
deleted file mode 100644
index 6a6c99a..0000000
--- a/_javascript/modules/components/img-lazyload.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Set up image lazy-load
- */
-
-function stopShimmer($node) {
- $node.parent().removeClass('shimmer');
-}
-
-export function imgLazy() {
- const $images = $('main img[data-src]');
-
- if ($images.length <= 0) {
- return;
- }
-
- /* Stop shimmer when image loaded */
- document.addEventListener('lazyloaded', function (e) {
- stopShimmer($(e.target));
- });
-
- /* Stop shimmer from cached images */
- $images.each(function () {
- if ($(this).hasClass('ls-is-cached')) {
- stopShimmer($(this));
- }
- });
-}
diff --git a/_javascript/modules/components/img-loading.js b/_javascript/modules/components/img-loading.js
new file mode 100644
index 0000000..c9b7b7f
--- /dev/null
+++ b/_javascript/modules/components/img-loading.js
@@ -0,0 +1,61 @@
+/**
+ * Setting up image lazy loading and LQIP switching
+ */
+
+const ATTR_DATA_SRC = 'data-src';
+const ATTR_DATA_LQIP = 'data-lqip';
+
+const cover = {
+ SHIMMER: 'shimmer',
+ BLUR: 'blur'
+};
+
+function removeCover(clzss) {
+ $(this).parent().removeClass(clzss);
+}
+
+function handleImage() {
+ if (!this.complete) {
+ return;
+ }
+
+ if (this.hasAttribute(ATTR_DATA_LQIP)) {
+ removeCover.call(this, cover.BLUR);
+ } else {
+ removeCover.call(this, cover.SHIMMER);
+ }
+}
+
+/**
+ * Switches the LQIP with the real image URL.
+ */
+function switchLQIP() {
+ const $img = $(this);
+ const src = $img.attr(ATTR_DATA_SRC);
+
+ $img.attr('src', encodeURI(src));
+ $img.removeAttr(ATTR_DATA_SRC);
+}
+
+export function loadImg() {
+ const $images = $('article img');
+
+ if ($images.length) {
+ $images.on('load', handleImage);
+ }
+
+ // Images loaded from the browser cache do not trigger the 'load' event
+ $('article img[loading="lazy"]').each(function () {
+ if (this.complete) {
+ removeCover.call(this, cover.SHIMMER);
+ }
+ });
+
+ // LQIPs set by the data URI or WebP will not trigger the 'load' event,
+ // so manually convert the URI to the URL of a high-resolution image.
+ const $lqips = $(`article img[${ATTR_DATA_LQIP}="true"]`);
+
+ if ($lqips.length) {
+ $lqips.each(switchLQIP);
+ }
+}
diff --git a/_javascript/modules/plugins.js b/_javascript/modules/plugins.js
index fa7a7dd..fb892e2 100644
--- a/_javascript/modules/plugins.js
+++ b/_javascript/modules/plugins.js
@@ -1,6 +1,6 @@
export { categoryCollapse } from './components/category-collapse';
export { initClipboard } from './components/clipboard';
-export { imgLazy } from './components/img-lazyload';
+export { loadImg } from './components/img-loading';
export { imgPopup } from './components/img-popup';
export { initLocaleDatetime } from './components/locale-datetime';
export { toc } from './components/toc';
diff --git a/_javascript/page.js b/_javascript/page.js
index 7b31813..f13bd2f 100644
--- a/_javascript/page.js
+++ b/_javascript/page.js
@@ -1,9 +1,9 @@
import { basic, initSidebar, initTopbar } from './modules/layouts';
-import { imgLazy, imgPopup, initClipboard } from './modules/plugins';
+import { loadImg, imgPopup, initClipboard } from './modules/plugins';
basic();
initSidebar();
initTopbar();
-imgLazy();
+loadImg();
imgPopup();
initClipboard();
diff --git a/_javascript/post.js b/_javascript/post.js
index 9a5a61b..86ea32b 100644
--- a/_javascript/post.js
+++ b/_javascript/post.js
@@ -1,17 +1,17 @@
import { basic, initSidebar, initTopbar } from './modules/layouts';
import {
- imgLazy,
+ loadImg,
imgPopup,
initLocaleDatetime,
initClipboard,
toc
} from './modules/plugins';
-basic();
initSidebar();
initTopbar();
-imgLazy();
+loadImg();
imgPopup();
initLocaleDatetime();
initClipboard();
toc();
+basic();
diff --git a/_layouts/default.html b/_layouts/default.html
index 16f52c2..f938a94 100644
--- a/_layouts/default.html
+++ b/_layouts/default.html
@@ -1,6 +1,5 @@
---
layout: compress
-# Default layout
---
@@ -9,14 +8,8 @@ layout: compress
{% include lang.html %}
-{% capture prefer_mode %}
- {% if site.theme_mode %}
- data-mode="{{ site.theme_mode }}"
- {% endif %}
-{% endcapture %}
-
-{% if layout.tail_includes %}
- {% assign has_tail = true %}
+{% if site.theme_mode %}
+ {% capture prefer_mode %}data-mode="{{ site.theme_mode }}"{% endcapture %}
{% endif %}
@@ -27,19 +20,20 @@ layout: compress
{% include sidebar.html lang=lang %}
-
+
{% include topbar.html lang=lang %}
-
-
- {{ content }}
+
+
+ {% if layout.refactor or layout.layout == 'default' %}
+ {% include refactor-content.html content=content lang=lang %}
+ {% else %}
+ {{ content }}
+ {% endif %}
-
{{- site.data.locales[include.lang].panel.toc -}}