Merge branch 'master' into production

This commit is contained in:
Cotes Chung 2022-11-22 21:08:49 +08:00
commit 5b5a3865ac
No known key found for this signature in database
GPG key ID: 0D9E54843167A808
27 changed files with 105 additions and 78 deletions

View file

@ -2,7 +2,17 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [5.3.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.3.0...v5.3.1) (2022-10-25) ## [5.3.2](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.3.1...v5.3.2) (2022-11-22)
### Bug Fixes
* `mermaid` occasionally fails to initialize ([#536](https://github.com/cotes2020/jekyll-theme-chirpy/issues/536)) ([48f14e3](https://github.com/cotes2020/jekyll-theme-chirpy/commit/48f14e39ac81bbfb3b9913ea3ee789d775b2d1ae))
* **comment:** disqus doesn't follow theme mode switching ([b0d5956](https://github.com/cotes2020/jekyll-theme-chirpy/commit/b0d5956f5a0ed894984d6b1754efeba04d8bc966))
* restore full-text search ([#741](https://github.com/cotes2020/jekyll-theme-chirpy/issues/741)) ([6774e0e](https://github.com/cotes2020/jekyll-theme-chirpy/commit/6774e0e1fb37cf467b14be481347412713763f05))
* the image URL in the SEO-related tags is incomplete ([#754](https://github.com/cotes2020/jekyll-theme-chirpy/issues/754)) ([f6e9a3f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/f6e9a3fccf7ab34db71f8aefaf86fdcc05861076))
## [5.3.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.3.0...v5.3.1) (2022-10-25)
### Bug Fixes ### Bug Fixes

View file

@ -102,4 +102,4 @@ This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chi
<!-- ReadMe links --> <!-- ReadMe links -->
[jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy [jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy
[cn-donation]: https://cotes2020.github.io/sponsor/ [cn-donation]: https://sponsor.cotes.page/

View file

@ -78,7 +78,7 @@ theme_mode: # [light|dark]
# will be added to all image (site avatar & posts' images) paths starting with '/' # will be added to all image (site avatar & posts' images) paths starting with '/'
# #
# e.g. 'https://cdn.com' # e.g. 'https://cdn.com'
img_cdn: 'https://raw.githubusercontent.com/cotes2020/chirpy-images/main' img_cdn: 'https://demo-img.cotes.page'
# the avatar on sidebar, support local or CORS resources # the avatar on sidebar, support local or CORS resources
avatar: '/commons/avatar.jpg' avatar: '/commons/avatar.jpg'

View file

@ -27,7 +27,7 @@ bootstrap-toc:
js: https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js js: https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js
fontawesome: fontawesome:
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css
search: search:
js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js

View file

@ -16,7 +16,7 @@ bootstrap-toc:
js: /assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js js: /assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js
fontawesome: fontawesome:
css: /assets/lib/fontawesome-free-5.15.4/css/all.min.css css: /assets/lib/fontawesome-free-6.2.1/css/all.min.css
search: search:
js: /assets/lib/simple-jekyll-search-1.10.0/simple-jekyll-search.min.js js: /assets/lib/simple-jekyll-search-1.10.0/simple-jekyll-search.min.js

View file

@ -15,7 +15,6 @@
}; };
/* Lazy loading */ /* Lazy loading */
var disqus_observer = new IntersectionObserver(function (entries) { var disqus_observer = new IntersectionObserver(function (entries) {
if(entries[0].isIntersecting) { if(entries[0].isIntersecting) {
(function () { (function () {
@ -32,23 +31,24 @@
disqus_observer.observe(document.querySelector('#disqus_thread')); disqus_observer.observe(document.querySelector('#disqus_thread'));
/* Auto switch theme */ /* Auto switch theme */
function reloadDisqus() { function reloadDisqus() {
/* Disqus hasn't been loaded */ if (event.source === window && event.data &&
if (typeof DISQUS === "undefined") { event.data.direction === ModeToggle.ID) {
return; /* Disqus hasn't been loaded */
} if (typeof DISQUS === "undefined") {
return;
}
if (document.readyState == 'complete') { if (document.readyState == 'complete') {
DISQUS.reset({ reload: true, config: disqus_config }); DISQUS.reset({ reload: true, config: disqus_config });
}
} }
} }
const modeToggle = document.querySelector(".mode-toggle"); const modeToggle = document.querySelector(".mode-toggle");
if (typeof modeToggle !== "undefined") { if (typeof modeToggle !== "undefined") {
/* modeToggle.addEventListener('click', reloadDisqus); // not pretty for 'color-scheme' */ window.addEventListener("message", reloadDisqus);
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', reloadDisqus);
} }
</script> </script>

View file

@ -22,23 +22,22 @@
{% seo title=false %} {% seo title=false %}
{% endcapture %} {% endcapture %}
{% if site.img_cdn and seo_tags contains 'og:image' %} {% if page.image %}
{% assign properties = 'og:image,twitter:image' | split: ',' %} {% assign img = page.image.path | default: page.image %}
{% assign img_path = page.img_path | append: '/' | append: img | replace: '//', '/' %}
{% capture target %}"{{ img | absolute_url }}"{% endcapture %}
{% for prop in properties %} {% if site.img_cdn contains '//' %}
{% if site.img_cdn contains '//' %} <!-- it's a cross-origin URL -->
<!-- `site.img_cdn` is a cross-origin URL --> {% capture replacement %}"{{ site.img_cdn }}{{ img_path }}"{% endcapture %}
{% capture target %}<meta property="{{ prop }}" content="{{ site.url }}{% endcapture %} {% else %}
{% capture replacement %}<meta property="{{ prop }}" content="{{ site.img_cdn }}{% endcapture %} <!-- it's a local file path -->
{% else %} {%- capture replacement -%}
<!-- `site.img_cdn` is a local file path --> "{{ site.img_cdn | append: '/' | append: img_path | replace: '//', '/' | absolute_url }}"
{% capture target %}<meta property="{{ prop }}" content="{{ site.url }}{{ site.baseurl }}{% endcapture %} {%- endcapture -%}
{% assign replacement = target | append: site.img_cdn %} {% endif %}
{% endif %}
{% assign seo_tags = seo_tags | replace: target, replacement %} {% assign seo_tags = seo_tags | replace: target, replacement %}
{% endfor %}
{% endif %} {% endif %}
{{ seo_tags }} {{ seo_tags }}

View file

@ -5,10 +5,11 @@
<script src="{{ site.data.assets[origin].mermaid.js | relative_url }}"></script> <script src="{{ site.data.assets[origin].mermaid.js | relative_url }}"></script>
<script> <script>
$(function() { (function () {
function updateMermaid(event) { function updateMermaid(event) {
if (event.source === window && event.data && if (event.source === window && event.data &&
event.data.direction === ModeToggle.ID) { event.data.direction === ModeToggle.ID) {
const mode = event.data.message; const mode = event.data.message;
@ -16,11 +17,11 @@
return; return;
} }
let expectedTheme = (mode === ModeToggle.DARK_MODE? "dark" : "default"); let expectedTheme = (mode === ModeToggle.DARK_MODE ? "dark" : "default");
let config = { theme: expectedTheme }; let config = {theme: expectedTheme};
/* Re-render the SVG <https://github.com/mermaid-js/mermaid/issues/311#issuecomment-332557344> */ /* Re-render the SVG <https://github.com/mermaid-js/mermaid/issues/311#issuecomment-332557344> */
$(".mermaid").each(function() { $(".mermaid").each(function () {
let svgCode = $(this).prev().children().html(); let svgCode = $(this).prev().children().html();
$(this).removeAttr("data-processed"); $(this).removeAttr("data-processed");
$(this).html(svgCode); $(this).html(svgCode);
@ -35,7 +36,7 @@
if ($("html[data-mode=dark]").length > 0 if ($("html[data-mode=dark]").length > 0
|| ($("html[data-mode]").length == 0 || ($("html[data-mode]").length == 0
&& window.matchMedia("(prefers-color-scheme: dark)").matches ) ) { && window.matchMedia("(prefers-color-scheme: dark)").matches)) {
initTheme = "dark"; initTheme = "dark";
} }
@ -43,15 +44,16 @@
theme: initTheme /* <default|dark|forest|neutral> */ theme: initTheme /* <default|dark|forest|neutral> */
}; };
/* Markdown converts to HTML */ /* Create mermaid tag */
$("pre").has("code.language-mermaid").each(function() { $("pre").has("code.language-mermaid").each(function () {
let svgCode = $(this).children().html(); let svgCode = $(this).children().html();
$(this).addClass("unloaded"); $(this).addClass("unloaded");
$(this).after(`<div class=\"mermaid\">${svgCode}</div>`); $(this).after(`<pre class=\"mermaid\">${svgCode}</pre>`);
}); });
mermaid.initialize(mermaidConf); mermaid.initialize(mermaidConf);
window.addEventListener("message", updateMermaid); window.addEventListener("message", updateMermaid);
}); })();
</script> </script>

View file

@ -107,13 +107,7 @@
<!-- Add image path --> <!-- Add image path -->
{% if page.img_path %} {% if page.img_path %}
{% assign _path = page.img_path %} {% assign _path = page.img_path | append: '/' | replace: '//', '/' %}
{% assign last_char = _path | slice: -1 %}
{% unless last_char == '/' %}
{% assign _path = _path | append: '/' %}
{% endunless %}
{% assign _src_prefix = _src_prefix | append: _path %} {% assign _src_prefix = _src_prefix | append: _path %}
{% endif %} {% endif %}

View file

@ -1,5 +1,5 @@
/*! /*!
* Chirpy v5.3.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.3.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View file

@ -26,13 +26,13 @@ tail_includes:
</span> </span>
{% endif %} {% endif %}
{% if page.image.path %} {% if page.image %}
{% capture bg %} {% capture bg %}
{% unless page.image.no_bg %}{{ 'bg' }}{% endunless %} {% unless page.image.no_bg %}{{ 'bg' }}{% endunless %}
{% endcapture %} {% endcapture %}
<div class="mt-3 mb-3"> <div class="mt-3 mb-3">
<img src="{{ page.image.path }}" class="preview-img {{ bg | strip }}" <img src="{{ page.image.path | default: page.image }}" class="preview-img {{ bg | strip }}"
alt="{{ page.image.alt | default: "Preview Image" }}" alt="{{ page.image.alt | default: "Preview Image" }}"
{% if page.image.width %} {% if page.image.width %}

View file

@ -243,7 +243,7 @@ If you want to add an image to the top of the post contents, specify the attribu
```yaml ```yaml
--- ---
image: image:
path: /path/to/image/file path: /path/to/image
width: 1000 # in pixels width: 1000 # in pixels
height: 400 # in pixels height: 400 # in pixels
alt: image alternative text alt: image alternative text
@ -254,7 +254,11 @@ Except for `alt`, all other options are necessary, especially the `width` and `h
Starting from _Chirpy v5.0.0_, the attributes `height` and `width` can be abbreviated: `height``h`, `width``w`. In addition, the [`img_path`](#image-path) can also be passed to the preview image, that is, when it has been set, the attribute `path` only needs the image file name. Starting from _Chirpy v5.0.0_, the attributes `height` and `width` can be abbreviated: `height``h`, `width``w`. In addition, the [`img_path`](#image-path) can also be passed to the preview image, that is, when it has been set, the attribute `path` only needs the image file name.
Starting from _Chirpy v5.2.0_, the property for the preview image is changed to `image.path`. If upgrading the theme from a prior version, you will have to update posts' metadata to use new image property. For simple use, you can also just use `image` to define the path.
```yml
image: /path/to/image
```
## Pinned Posts ## Pinned Posts

View file

@ -109,6 +109,12 @@ Now you can choose ONE of the following methods to deploy your Jekyll site.
Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`{: .filepath}. Otherwise, create a new one and fill in the contents of the [sample file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name. And then rename your repository to `<GH_USERNAME>.github.io` on GitHub. Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`{: .filepath}. Otherwise, create a new one and fill in the contents of the [sample file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name. And then rename your repository to `<GH_USERNAME>.github.io` on GitHub.
Furthermore, if you have committed `Gemfile.lock`{: .filepath} to the repository and your local machine is not Linux, go the the root directory of your site and update the platform list:
```console
$ bundle lock --add-platform x86_64-linux
```
Now publish your Jekyll site: Now publish your Jekyll site:
1. Browse to your repository on GitHub. Select the tab _Settings_, then click _Pages_ in the left navigation bar. Then, in the **Source** section (under _Build and deployment_), select [**GitHub Actions**][pages-workflow-src] from the dropdown menu. 1. Browse to your repository on GitHub. Select the tab _Settings_, then click _Pages_ in the left navigation bar. Then, in the **Source** section (under _Build and deployment_), select [**GitHub Actions**][pages-workflow-src] from the dropdown menu.

View file

@ -461,21 +461,24 @@ img[data-src] {
} }
} }
> ol, ol,
> ul { ul {
-webkit-padding-start: 1.75rem; &:not([class]),
padding-inline-start: 1.75rem; &.task-list {
-webkit-padding-start: 1.75rem;
padding-inline-start: 1.75rem;
li { li {
margin: 0.25rem 0; margin: 0.25rem 0;
padding-left: 0.25rem; padding-left: 0.25rem;
} }
ol, ol,
ul { ul {
-webkit-padding-start: 1rem; -webkit-padding-start: 1.25rem;
padding-inline-start: 1rem; padding-inline-start: 1.25rem;
margin: 0.5rem 0; margin: 0.5rem 0;
}
} }
} }

View file

@ -1,7 +1,7 @@
/*! /*!
* The styles for Jekyll theme Chirpy * The styles for Jekyll theme Chirpy
* *
* Chirpy v5.3.1 (https://github.com/cotes2020/jekyll-theme-chirpy) * Chirpy v5.3.2 (https://github.com/cotes2020/jekyll-theme-chirpy)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View file

@ -12,7 +12,9 @@ swcache: true
"tags": {{ post.tags | join: ', ' | jsonify }}, "tags": {{ post.tags | join: ', ' | jsonify }},
"date": "{{ post.date }}", "date": "{{ post.date }}",
{% include no-linenos.html content=post.content %} {% include no-linenos.html content=post.content %}
"snippet": {{ content | strip_html | strip_newlines | truncate: 200 | jsonify }} {% assign _content = content | strip_html | strip_newlines %}
"snippet": {{ _content | truncate: 200 | jsonify }},
"content": {{ _content | jsonify }}
}{% unless forloop.last %},{% endunless %} }{% unless forloop.last %},{% endunless %}
{% endfor %} {% endfor %}
] ]

View file

@ -1,5 +1,5 @@
/*! /*!
* Chirpy v5.3.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.3.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View file

@ -1,5 +1,5 @@
/*! /*!
* Chirpy v5.3.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.3.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View file

@ -1,5 +1,5 @@
/*! /*!
* Chirpy v5.3.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.3.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View file

@ -1,5 +1,5 @@
/*! /*!
* Chirpy v5.3.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.3.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View file

@ -1,5 +1,5 @@
/*! /*!
* Chirpy v5.3.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.3.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View file

@ -1,5 +1,5 @@
/*! /*!
* Chirpy v5.3.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.3.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View file

@ -1,5 +1,5 @@
/*! /*!
* Chirpy v5.3.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.3.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

@ -1 +1 @@
Subproject commit b2842d6583088cb6b33ad50093a39a3e2cf2c026 Subproject commit 5d177b3cbbea89e3392eb48c0ee580c6a0ce41d1

View file

@ -2,7 +2,7 @@
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "jekyll-theme-chirpy" spec.name = "jekyll-theme-chirpy"
spec.version = "5.3.1" spec.version = "5.3.2"
spec.authors = ["Cotes Chung"] spec.authors = ["Cotes Chung"]
spec.email = ["cotes.chung@gmail.com"] spec.email = ["cotes.chung@gmail.com"]

View file

@ -1,6 +1,6 @@
{ {
"name": "jekyll-theme-chirpy", "name": "jekyll-theme-chirpy",
"version": "5.3.1", "version": "5.3.2",
"description": "A minimal, responsive, and powerful Jekyll theme for presenting professional writing.", "description": "A minimal, responsive, and powerful Jekyll theme for presenting professional writing.",
"repository": { "repository": {
"type": "git", "type": "git",

View file

@ -104,6 +104,10 @@ check() {
_bump_file() { _bump_file() {
for i in "${!FILES[@]}"; do for i in "${!FILES[@]}"; do
if [[ ${FILES[$i]} == $NODE_CONFIG ]]; then
continue
fi
sed -i "s/v[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/v$1/" "${FILES[$i]}" sed -i "s/v[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/v$1/" "${FILES[$i]}"
done done
@ -183,7 +187,10 @@ main() {
fi fi
fi fi
_version="$(grep '"version":' package.json | sed 's/.*: "//;s/".*//')" # Change heading of Patch version to level 2 (a bug from `standard-version`)
sed -i "s/^### \[/## \[/g" CHANGELOG.md
_version="$(grep '"version":' "$NODE_CONFIG" | sed 's/.*: "//;s/".*//')"
echo -e "Bump version number to $_version\n" echo -e "Bump version number to $_version\n"
bump "$_version" bump "$_version"