Skip to content

Commit 7d41bbf

Browse files
committed
Update
1 parent 9d6ec8b commit 7d41bbf

File tree

7 files changed

+38
-28
lines changed

7 files changed

+38
-28
lines changed

.github/workflows/docker-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ jobs:
105105
push: true
106106
tags: ${{ steps.meta.outputs.tags }}
107107
labels: ${{ steps.meta.outputs.labels }}
108-
# cache-from: type=gha
109-
# cache-to: type=gha,mode=max
108+
cache-from: type=gha
109+
cache-to: type=gha,mode=max
110110
- name: Generate Build Attestation (SLSA)
111111
uses: actions/attest-build-provenance@v3
112112
with:

images/fragment/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM python:alpine
33

44
COPY --chmod=755 bin/ /usr/local/bin/
55

6-
RUN apk add --no-cache \
6+
RUN apk add \
77
bash tini tar zstd \
88
git git-fast-import \
99
ca-certificates curl wget pandoc-cli
@@ -17,7 +17,7 @@ RUN python3 -m venv $VIRTUAL_ENV
1717
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
1818

1919
COPY requirements.txt .
20-
RUN pip install --no-cache-dir -r requirements.txt
20+
RUN pip install -r requirements.txt
2121

2222
COPY scripts/ /app/scripts/
2323
COPY templates/ /app/templates/

images/fragment/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pyyaml
77
# better
88
# mkdocs-rss-plugin
99
# mkdocs-katex-ssr
10-
# mkdocs-minify-html-plugin
10+
mkdocs-minify-html-plugin
1111

1212
# seo
1313
# mkdocs-advanced-seo

images/fragment/scripts/html-cleanup.lua

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ end
7272
function Span(el)
7373
if el.classes and el.classes:includes("arithmatex") then
7474
local text = pandoc.utils.stringify(el.content)
75-
text = text:gsub("^%s*%[", ""):gsub("%]%s*$", "") -- 去 []
75+
-- 更加激进地清理公式前后的各种包装符号
76+
text = text:gsub("^%s*[\\%[%(%$%]]+", ""):gsub("[\\%]%)%$%s]+$", "")
7677
text = unescape_math(text)
77-
return pandoc.Math("InlineMath", text)
78+
-- 确保是单 $ 包裹
79+
return pandoc.RawInline("markdown", "$" .. text .. "$")
7880
end
7981
end
8082

@@ -85,7 +87,9 @@ function Div(el)
8587
local text = pandoc.utils.stringify(el.content)
8688
text = text:gsub("^%s*[$]+", ""):gsub("[$]+%s*$", "")
8789
text = unescape_math(text)
88-
return pandoc.Math("DisplayMath", text)
90+
-- 修复 $$ 与内容之间的换行。
91+
-- 如果直接写 "\n\n" 会导致多余空行,这里使用 "\n"
92+
return pandoc.RawBlock("markdown", "$$\n" .. text .. "\n$$")
8993
end
9094

9195
-- 识别 callout 类型
@@ -137,6 +141,12 @@ function Div(el)
137141
return pandoc.RawBlock("markdown", full_md)
138142
end
139143

144+
-- 处理多余的容器(如 .grid 或 .v-pre 等非语义化 Div)
145+
-- 如果 Div 只有渲染意义而用户不希望在 Markdown 中保留 ::: {.grid}
146+
if el.classes and (el.classes:includes("grid") or el.classes:includes("v-pre")) then
147+
return el.content
148+
end
149+
140150
return el
141151
end
142152

images/fragment/templates/template.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ theme:
1111
plugins:
1212
# - markdown-exec
1313
- table-reader
14-
# - minify_html:
15-
# allow_noncompliant_unquoted_attribute_values: false
16-
# allow_optimal_entities: false
17-
# allow_removing_spaces_between_attributes: false
18-
# keep_closing_tags: true
19-
# keep_comments: false
20-
# keep_html_and_head_opening_tags: true
21-
# keep_input_type_text_attr: true
22-
# keep_ssi_comments: false
23-
# minify_css: true
24-
# minify_doctype: false
25-
# minify_js: true
26-
# preserve_brace_template_syntax: true
27-
# preserve_chevron_percent_template_syntax: true
28-
# remove_bangs: false
29-
# remove_processing_instructions: false
14+
- minify_html:
15+
allow_noncompliant_unquoted_attribute_values: false
16+
allow_optimal_entities: false
17+
allow_removing_spaces_between_attributes: false
18+
keep_closing_tags: true
19+
keep_comments: false
20+
keep_html_and_head_opening_tags: true
21+
keep_input_type_text_attr: true
22+
keep_ssi_comments: false
23+
minify_css: true
24+
minify_doctype: false
25+
minify_js: true
26+
preserve_brace_template_syntax: true
27+
preserve_chevron_percent_template_syntax: true
28+
remove_bangs: false
29+
remove_processing_instructions: false
3030
markdown_extensions:
3131
- abbr
3232
- admonition

images/mkdocs/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM python:alpine
33

44
COPY --chmod=755 bin/ /usr/local/bin/
55

6-
RUN apk add --no-cache \
6+
RUN apk add \
77
bash tini tar zstd \
88
git git-fast-import \
99
ca-certificates curl wget \
@@ -22,7 +22,7 @@ RUN python3 -m venv $VIRTUAL_ENV
2222
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
2323

2424
COPY requirements.txt .
25-
RUN pip install --no-cache-dir -r requirements.txt
25+
RUN pip install -r requirements.txt
2626

2727
COPY posthtml/gulpfile.js .
2828

images/seo/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM python:alpine
33

44
COPY --chmod=755 seo-push /usr/local/bin/
55

6-
RUN apk add --no-cache \
6+
RUN apk add \
77
bash tini tar zstd \
88
git git-fast-import \
99
ca-certificates curl wget
@@ -16,7 +16,7 @@ ENV VIRTUAL_ENV=/opt/venv
1616
RUN python3 -m venv $VIRTUAL_ENV
1717
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
1818

19-
RUN pip install --no-cache-dir requests
19+
RUN pip install requests
2020

2121
COPY main.py .
2222

0 commit comments

Comments
 (0)