mirror of
https://github.com/Dichgrem/Blog.git
synced 2026-02-04 17:11:57 -05:00
Compare commits
10 Commits
202d32c8d6
...
c6e6bf3450
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6e6bf3450 | ||
|
|
4749aacb0f | ||
|
|
aea50b44ca | ||
|
|
07d1060183 | ||
|
|
382e05ea76 | ||
|
|
3d6d0a45f3 | ||
|
|
707ca3ab64 | ||
|
|
f163f4b97f | ||
|
|
d7ada4842b | ||
|
|
8d959b9c1b |
16
config.toml
16
config.toml
@@ -22,6 +22,22 @@ taxonomies = [
|
||||
[markdown]
|
||||
highlight_code = true
|
||||
highlight_theme = "boron"
|
||||
render_emoji = false
|
||||
external_links_target_blank = true
|
||||
external_links_no_follow = true
|
||||
external_links_no_referrer = true
|
||||
smart_punctuation = false
|
||||
bottom_footnotes = true
|
||||
table_of_contents = { start_level = 2, end_level = 4 }
|
||||
|
||||
[markdown.highlight_themes]
|
||||
light = "boron"
|
||||
dark = "dracula"
|
||||
|
||||
[slugify]
|
||||
paths = "on"
|
||||
taxonomies = "on"
|
||||
anchors = "on"
|
||||
|
||||
[extra]
|
||||
|
||||
|
||||
@@ -578,6 +578,17 @@ nft list table ip mangle
|
||||
- 关闭防火墙的禁止转发规则,全部允许;
|
||||
- 将X86主路由的网线插到AP的任意一个LAN口。
|
||||
|
||||
## 更新所有包
|
||||
|
||||
```
|
||||
opkg update
|
||||
|
||||
opkg list-upgradable \
|
||||
| awk '{print $1}' \
|
||||
| grep -vE '^(base-files|busybox|libc|libgcc|libstdc\+\+|procd|netifd|ubus|uci|kernel|kmod-|fstools|mtd|fwtool)$' \
|
||||
| xargs -r opkg upgrade
|
||||
```
|
||||
|
||||
## 🔗
|
||||
|
||||
- [Openwrt wiki](https://openwrt.org/zh/docs/start)
|
||||
|
||||
@@ -178,7 +178,7 @@ tags = ["Windows"]
|
||||
- **抓包**: [Wireshark](https://www.wireshark.org/download.html)
|
||||
- **启动器**: [Flow.Launcher](https://github.com/Flow-Launcher/Flow.Launcher)
|
||||
- **输入法**: [Rime](https://rime.im/download/)
|
||||
- **浏览器**: [Floorp](https://github.com/Floorp-Projects/Floorp) / [Chrome](https://www.google.com/chrome/)
|
||||
- **浏览器**: [Floorp](https://github.com/Floorp-Projects/Floorp) / [Chrome](https://dl.google.com/tag/s/installdataindex/update2/installers/ChromeStandaloneSetup64.exe)
|
||||
- **编辑器**: [VSCodium](https://github.com/VSCodium/vscodium)
|
||||
- **虚拟机**: Hyper‑V
|
||||
- **科学上网**: [GFS](https://github.com/GUI-for-Cores/GUI.for.SingBox)
|
||||
|
||||
32
sass/copy.scss
Normal file
32
sass/copy.scss
Normal file
@@ -0,0 +1,32 @@
|
||||
.copy-button {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
padding: 4px 10px;
|
||||
font-size: 0.8rem;
|
||||
font-family: DejaVu Sans Mono, Monaco, Consolas, Ubuntu Mono, monospace;
|
||||
background: var(--accent);
|
||||
color: var(--background);
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease;
|
||||
z-index: 1;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
&.copied {
|
||||
background: #4caf50;
|
||||
}
|
||||
}
|
||||
|
||||
pre:hover .copy-button {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
pre:hover .copy-button:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
@@ -133,6 +133,7 @@ pre {
|
||||
overflow: auto;
|
||||
border-top: 1px solid rgba(255, 255, 255, .1);
|
||||
border-bottom: 1px solid rgba(255, 255, 255, .1);
|
||||
position: relative;
|
||||
|
||||
@media (max-width: $phone-max-width) {
|
||||
white-space: pre-wrap;
|
||||
|
||||
@@ -4,5 +4,7 @@
|
||||
@import 'logo';
|
||||
@import 'main';
|
||||
@import 'post';
|
||||
@import 'toc';
|
||||
@import 'copy';
|
||||
@import 'pagination';
|
||||
@import 'footer';
|
||||
|
||||
88
sass/toc.scss
Normal file
88
sass/toc.scss
Normal file
@@ -0,0 +1,88 @@
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
.toc-container {
|
||||
position: fixed;
|
||||
right: 150px;
|
||||
top: 180px;
|
||||
width: 250px;
|
||||
max-height: calc(100vh - 200px);
|
||||
overflow-y: auto;
|
||||
z-index: 10;
|
||||
display: none;
|
||||
|
||||
@media (min-width: 1400px) {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.toc {
|
||||
padding: 15px 0;
|
||||
|
||||
&-title {
|
||||
font-weight: bold;
|
||||
font-size: 1.1rem;
|
||||
margin-bottom: 12px;
|
||||
color: var(--color);
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
padding-left: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
margin: 4px 0;
|
||||
}
|
||||
|
||||
ul ul {
|
||||
padding-left: 20px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
a {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: var(--color);
|
||||
font-size: 0.9rem;
|
||||
padding: 2px 0;
|
||||
transition: color 0.2s ease;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
&:target {
|
||||
color: var(--accent);
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.toc-level-1 {
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.toc-level-2 {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.toc-level-3 {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.toc-level-4,
|
||||
.toc-level-5,
|
||||
.toc-level-6 {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
}
|
||||
|
||||
.post-content {
|
||||
scroll-margin-top: 80px;
|
||||
}
|
||||
34
static/copy.js
Normal file
34
static/copy.js
Normal file
@@ -0,0 +1,34 @@
|
||||
(function() {
|
||||
document.querySelectorAll('pre code').forEach((codeBlock) => {
|
||||
const pre = codeBlock.parentElement;
|
||||
|
||||
if (pre.querySelector('.copy-button')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const copyButton = document.createElement('button');
|
||||
copyButton.className = 'copy-button';
|
||||
copyButton.textContent = '复制';
|
||||
copyButton.setAttribute('aria-label', '复制代码');
|
||||
copyButton.setAttribute('type', 'button');
|
||||
|
||||
copyButton.addEventListener('click', () => {
|
||||
navigator.clipboard.writeText(codeBlock.textContent.trimEnd()).then(() => {
|
||||
copyButton.textContent = '已复制!';
|
||||
copyButton.classList.add('copied');
|
||||
|
||||
setTimeout(() => {
|
||||
copyButton.textContent = '复制';
|
||||
copyButton.classList.remove('copied');
|
||||
}, 2000);
|
||||
}).catch((err) => {
|
||||
copyButton.textContent = '失败';
|
||||
setTimeout(() => {
|
||||
copyButton.textContent = '复制';
|
||||
}, 2000);
|
||||
});
|
||||
});
|
||||
|
||||
pre.appendChild(copyButton);
|
||||
});
|
||||
})();
|
||||
@@ -10,5 +10,41 @@
|
||||
{{ post_macros::content(page=page, summary=false, show_only_description=false) }}
|
||||
{{ post_macros::earlier_later(page=page) }}
|
||||
</div>
|
||||
{% if page.toc %}
|
||||
<div class="toc-container">
|
||||
<div class="toc">
|
||||
<div class="toc-title">目录</div>
|
||||
<ul>
|
||||
{% for h in page.toc %}
|
||||
<li class="toc-level-{{ h.level }}">
|
||||
<a href="#{{ h.id | safe }}">{{ h.title }}</a>
|
||||
{% if h.children %}
|
||||
<ul>
|
||||
{% for h2 in h.children %}
|
||||
<li class="toc-level-{{ h2.level }}">
|
||||
<a href="#{{ h2.id | safe }}">{{ h2.title }}</a>
|
||||
{% if h2.children %}
|
||||
<ul>
|
||||
{% for h3 in h2.children %}
|
||||
<li class="toc-level-{{ h3.level }}">
|
||||
<a href="#{{ h3.id | safe }}">{{ h3.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
||||
{% block extra_body %}
|
||||
<script src="{{ get_url(path='copy.js', trailing_slash=false) | safe }}"></script>
|
||||
{% endblock extra_body %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user