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.
### [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

View file

@ -102,4 +102,4 @@ This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chi
<!-- ReadMe links -->
[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 '/'
#
# 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
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
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:
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
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:
js: /assets/lib/simple-jekyll-search-1.10.0/simple-jekyll-search.min.js

View file

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

View file

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

View file

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

View file

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

View file

@ -26,13 +26,13 @@ tail_includes:
</span>
{% endif %}
{% if page.image.path %}
{% if page.image %}
{% capture bg %}
{% unless page.image.no_bg %}{{ 'bg' }}{% endunless %}
{% endcapture %}
<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" }}"
{% 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
---
image:
path: /path/to/image/file
path: /path/to/image
width: 1000 # in pixels
height: 400 # in pixels
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.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

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.
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:
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,8 +461,10 @@ img[data-src] {
}
}
> ol,
> ul {
ol,
ul {
&:not([class]),
&.task-list {
-webkit-padding-start: 1.75rem;
padding-inline-start: 1.75rem;
@ -473,11 +475,12 @@ img[data-src] {
ol,
ul {
-webkit-padding-start: 1rem;
padding-inline-start: 1rem;
-webkit-padding-start: 1.25rem;
padding-inline-start: 1.25rem;
margin: 0.5rem 0;
}
}
}
ul.task-list {
-webkit-padding-start: 1.25rem;

View file

@ -1,7 +1,7 @@
/*!
* 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
* MIT Licensed
*/

View file

@ -12,7 +12,9 @@ swcache: true
"tags": {{ post.tags | join: ', ' | jsonify }},
"date": "{{ post.date }}",
{% 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 %}
{% 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
* 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
* 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
* 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
* 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
* 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
* 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
* MIT Licensed
*/

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

View file

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

View file

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

View file

@ -104,6 +104,10 @@ check() {
_bump_file() {
for i in "${!FILES[@]}"; do
if [[ ${FILES[$i]} == $NODE_CONFIG ]]; then
continue
fi
sed -i "s/v[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/v$1/" "${FILES[$i]}"
done
@ -183,7 +187,10 @@ main() {
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"
bump "$_version"