Skip to content

Commit

Permalink
mathjsx
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgzn committed Aug 17, 2024
1 parent dbcb5d7 commit 69a123b
Show file tree
Hide file tree
Showing 73 changed files with 3,797 additions and 17 deletions.
34 changes: 17 additions & 17 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,41 @@ theme: jekyll-theme-chirpy
lang: en

# Change to your timezone › https://kevinnovak.github.io/Time-Zone-Picker
timezone:
timezone: Asia/Shanghai

# jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
# ↓ --------------------------

title: Chirpy # the main title
title: XYZ # the main title

tagline: A text-focused Jekyll theme # it will display as the sub-title
tagline: CMX,DYB,TWZ ---XYZ # 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', note that it does not end with a '/'.
url: ""
url: "https://zdongs.github.io"

github:
username: github_username # change to your github username
username: zdongs # change to your github username

twitter:
username: twitter_username # change to your twitter username

social:
# Change to your full name.
# It will be displayed as the default author of the posts and the copyright owner in the Footer
name: your_full_name
name: XYZ
email: [email protected] # change to your email address
links:
# The first element serves as the copyright owner's link
- https://twitter.com/username # change to your twitter homepage
- https://github.com/username # change to your github homepage
- https://github.com/zdongs # change to your github homepage
# Uncomment below to add more social links
# - https://www.facebook.com/username
# - https://www.linkedin.com/in/username
# - https://www.linkedin.com/

# Site Verification Settings
webmaster_verifications:
Expand Down Expand Up @@ -93,10 +94,10 @@ theme_mode: # [light | dark]
# will be added to all media resources (site avatar, posts' images, audio and video files) paths starting with '/'
#
# e.g. 'https://cdn.com'
cdn:
cdn: "https://chirpy-img.netlify.app"

# the avatar on sidebar, support local or CORS resources
avatar:
avatar: "/commons/avatar.jpg"

# The URL of the site-wide social preview image used in SEO `og:image` meta tag.
# It can be overridden by a customized `page.image` in front matter.
Expand All @@ -110,11 +111,11 @@ comments:
provider: # [disqus | utterances | giscus]
# The provider options are as follows:
disqus:
shortname: # fill with the Disqus shortname. › https://help.disqus.com/en/articles/1717111-what-s-a-shortname
shortname: xyz-ai # fill with the Disqus shortname. › https://help.disqus.com/en/articles/1717111-what-s-a-shortname
# utterances settings › https://utteranc.es/
utterances:
repo: # <gh-username>/<repo>
issue_term: # < url | pathname | title | ...>
repo: zdongs/zdongs.github.io # <gh-username>/<repo>
issue_term: title # < url | pathname | title | ...>
# Giscus options › https://giscus.app
giscus:
repo: # <gh-username>/<repo>
Expand Down Expand Up @@ -168,6 +169,9 @@ collections:
tabs:
output: true
sort_by: order
app:
output: true
permalink: /:name

defaults:
- scope:
Expand All @@ -190,10 +194,6 @@ defaults:
values:
layout: page
permalink: /:title/
- scope:
path: assets/js/dist
values:
swcache: true

sass:
style: compressed
Expand Down
7 changes: 7 additions & 0 deletions _includes/analytics/cloudflare.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!-- Cloudflare Web Analytics -->
<script
defer
src="https://static.cloudflareinsights.com/beacon.min.js"
data-cf-beacon='{"token": "{{ site.analytics.cloudflare.id }}"}'
></script>
<!-- End Cloudflare Web Analytics -->
6 changes: 6 additions & 0 deletions _includes/analytics/goatcounter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- GoatCounter -->
<script
async
src="https://gc.zgo.at/count.js"
data-goatcounter="https://{{ site.analytics.goatcounter.id }}.goatcounter.com/count"
></script>
13 changes: 13 additions & 0 deletions _includes/analytics/google.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script defer src="https://www.googletagmanager.com/gtag/js?id={{ site.analytics.google.id }}"></script>
<script>
document.addEventListener('DOMContentLoaded', function (event) {
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}

gtag('js', new Date());
gtag('config', '{{ site.analytics.google.id }}');
});
</script>
14 changes: 14 additions & 0 deletions _includes/analytics/matomo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//{{ site.analytics.matomo.domain }}/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', {{ site.analytics.matomo.id }}]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
6 changes: 6 additions & 0 deletions _includes/analytics/umami.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- Umami -->
<script
defer
src="{{ site.analytics.umami.domain }}/script.js"
data-website-id="{{ site.analytics.umami.id }}"
></script>
5 changes: 5 additions & 0 deletions _includes/comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- The comments switcher -->
{% if page.comments and site.comments.provider %}
{% capture path %}comments/{{ site.comments.provider }}.html{% endcapture %}
{% include {{ path }} %}
{% endif %}
50 changes: 50 additions & 0 deletions _includes/comments/disqus.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!-- The Disqus lazy loading. -->

<div id="disqus_thread">
<p class="text-center text-muted small">Comments powered by <a href="https://disqus.com/">Disqus</a>.</p>
</div>

<script type="text/javascript">
var disqus_config = function () {
this.page.url = '{{ page.url | absolute_url }}';
this.page.identifier = '{{ page.url }}';
};

{%- comment -%} Lazy loading {%- endcomment -%}
var disqus_observer = new IntersectionObserver(
function (entries) {
if (entries[0].isIntersecting) {
(function () {
var d = document,
s = d.createElement('script');
s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();

disqus_observer.disconnect();
}
},
{ threshold: [0] }
);

disqus_observer.observe(document.getElementById('disqus_thread'));

{%- comment -%} Auto switch theme {%- endcomment -%}
function reloadDisqus() {
if (event.source === window && event.data && event.data.direction === ModeToggle.ID) {
{%- comment -%} Disqus hasn't been loaded {%- endcomment -%}
if (typeof DISQUS === 'undefined') {
return;
}

if (document.readyState == 'complete') {
DISQUS.reset({ reload: true, config: disqus_config });
}
}
}

if (document.getElementById('mode-toggle')) {
window.addEventListener('message', reloadDisqus);
}
</script>
71 changes: 71 additions & 0 deletions _includes/comments/giscus.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!-- https://giscus.app/ -->
<script type="text/javascript">
(function () {
const origin = 'https://giscus.app';
const lightTheme = 'light';
const darkTheme = 'dark_dimmed';

let initTheme = lightTheme;
const html = document.documentElement;

if (
(html.hasAttribute('data-mode') &&
html.getAttribute('data-mode') === 'dark') ||
(!html.hasAttribute('data-mode') &&
window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
initTheme = darkTheme;
}

let lang = '{{ site.comments.giscus.lang | default: lang }}';
{%- comment -%} https://github.com/giscus/giscus/tree/main/locales {%- endcomment -%}
if (lang.length > 2 && !lang.startsWith('zh')) {
lang = lang.slice(0, 2);
}

let giscusAttributes = {
src: 'https://giscus.app/client.js',
'data-repo': '{{ site.comments.giscus.repo}}',
'data-repo-id': '{{ site.comments.giscus.repo_id }}',
'data-category': '{{ site.comments.giscus.category }}',
'data-category-id': '{{ site.comments.giscus.category_id }}',
'data-mapping': '{{ site.comments.giscus.mapping | default: 'pathname' }}',
'data-strict' : '{{ site.comments.giscus.strict | default: '0' }}',
'data-reactions-enabled': '{{ site.comments.giscus.reactions_enabled | default: '1' }}',
'data-emit-metadata': '0',
'data-theme': initTheme,
'data-input-position': '{{ site.comments.giscus.input_position | default: 'bottom' }}',
'data-lang': lang,
'data-loading': 'lazy',
crossorigin: 'anonymous',
async: ''
};

let giscusScript = document.createElement('script');
Object.entries(giscusAttributes).forEach(([key, value]) =>
giscusScript.setAttribute(key, value)
);
document.getElementById('tail-wrapper').appendChild(giscusScript);

addEventListener('message', (event) => {
if (
event.source === window &&
event.data &&
event.data.direction === ModeToggle.ID
) {
{%- comment -%} global theme mode changed {%- endcomment -%}
const mode = event.data.message;
const theme = mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme;

const message = {
setConfig: {
theme: theme
}
};

const giscus = document.getElementsByClassName('giscus-frame')[0].contentWindow;
giscus.postMessage({ giscus: message }, origin);
}
});
})();
</script>
49 changes: 49 additions & 0 deletions _includes/comments/utterances.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!-- https://utteranc.es/ -->
<script
src="https://utteranc.es/client.js"
repo="{{ site.comments.utterances.repo }}"
issue-term="{{ site.comments.utterances.issue_term }}"
crossorigin="anonymous"
async
></script>

<script type="text/javascript">
(function () {
const origin = 'https://utteranc.es';
const lightTheme = 'github-light';
const darkTheme = 'github-dark';
let initTheme = lightTheme;
const html = document.documentElement;

if (
(html.hasAttribute('data-mode') && html.getAttribute('data-mode') === 'dark') ||
(!html.hasAttribute('data-mode') && window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
initTheme = darkTheme;
}

addEventListener('message', (event) => {
let theme;

{%- comment -%} credit to <https://github.com/utterance/utterances/issues/170#issuecomment-594036347> {%- endcomment -%}
if (event.origin === origin) {
{%- comment -%} page initial {%- endcomment -%}
theme = initTheme;
} else if (event.source === window && event.data && event.data.direction === ModeToggle.ID) {
{%- comment -%} global theme mode changed {%- endcomment -%}
const mode = event.data.message;
theme = mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme;
} else {
return;
}

const message = {
type: 'set-theme',
theme: theme
};

const utterances = document.getElementsByClassName('utterances-frame')[0].contentWindow;
utterances.postMessage(message, origin);
});
})();
</script>
20 changes: 20 additions & 0 deletions _includes/datetime.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
Date format snippet
See: ${JS_ROOT}/utils/locale-dateime.js
-->

{% assign df_strftime = site.data.locales[include.lang].df.post.strftime | default: '%d/%m/%Y' %}
{% assign df_dayjs = site.data.locales[include.lang].df.post.dayjs | default: 'DD/MM/YYYY' %}

<time
{% if include.class %}
class="{{ include.class }}"
{% endif %}
data-ts="{{ include.date | date: '%s' }}"
data-df="{{ df_dayjs }}"
{% if include.tooltip %}
data-bs-toggle="tooltip" data-bs-placement="bottom"
{% endif %}
>
{{ include.date | date: df_strftime }}
</time>
35 changes: 35 additions & 0 deletions _includes/embed/audio.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{% assign src = include.src | strip %}
{% assign title = include.title | strip %}
{% assign types = include.types | default: '' | strip | split: '|' %}

{% unless src contains '://' %}
{%- capture src -%}
{% include media-url.html src=src subpath=page.media_subpath %}
{%- endcapture -%}
{% endunless %}

<p>
<audio class="embed-audio" controls>
{% assign extension = src | split: '.' | last %}
{% assign types = extension | concat: types %}

{% assign ext_size = extension | size %}
{% assign src_size = src | size %}
{% assign slice_size = src_size | minus: ext_size %}

{% assign filepath = src | slice: 0, slice_size %}

{% for type in types %}
{% assign src = filepath | append: type %}
{% assign media_item = site.data.media | find: 'extension', type %}
{% assign mime_type = media_item.mime_type | default: type %}
<source src="{{ src }}" type="audio/{{ mime_type }}">
{% endfor %}

Your browser does not support the audio tag. Here is a
<a href="{{ src | strip }}">link to the audio file</a> instead.
</audio>
{% if title %}
<em>{{ title }}</em>
{% endif %}
</p>
9 changes: 9 additions & 0 deletions _includes/embed/bilibili.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<iframe
class="embed-video"
loading="lazy"
src="https://player.bilibili.com/player.html?bvid={{ include.id }}"
scrolling="no"
frameborder="0"
framespacing="0"
allowfullscreen="true"
></iframe>
Loading

0 comments on commit 69a123b

Please sign in to comment.