-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a69709
commit 119347b
Showing
7 changed files
with
35 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore | ||
|
||
demo | ||
论文.md | ||
|
||
# Logs | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "markdown-paper", | ||
"type": "module", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"author": { | ||
"name": "LeafYeeXYZ", | ||
"email": "[email protected]" | ||
|
@@ -10,7 +10,7 @@ | |
"scripts": { | ||
"mdp": "bun ./bin/mdp.ts", | ||
"pub": "npm publish", | ||
"try": "bun mdp ../../GoogleDrive/Curriculum/论文写作/论文.md --out=./demo/论文 --outputHTML" | ||
"try": "bun mdp ./论文.md --out=./demo/论文 --outputHTML" | ||
}, | ||
"bin": { | ||
"mdp": "./bin/mdp.ts" | ||
|
@@ -23,6 +23,6 @@ | |
}, | ||
"dependencies": { | ||
"marked": "^12.0.2", | ||
"puppeteer-core": "^22.9.0" | ||
"puppeteer": "^22.9.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,9 +48,17 @@ export class APS extends Theme { | |
} | ||
|
||
// preParseHTML | ||
// 把包裹图片的 p 标签去掉 | ||
this.preParseHTML = (html: string): string => { | ||
// 把包裹图片的 p 标签去掉 | ||
html = html.replace(/<p><img (.*?)><\/p>/g, '<img $1>') | ||
// 加载字体 | ||
html = html.replace(/<\/head>/, ` | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:[email protected]&display=swap" rel="stylesheet"> | ||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:[email protected]&display=swap" rel="stylesheet"> | ||
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif:[email protected]&display=swap" rel="stylesheet"> | ||
`) | ||
return html | ||
} | ||
|
||
|
@@ -114,8 +122,8 @@ export class APS extends Theme { | |
left: '2.5cm' | ||
}, | ||
displayHeaderFooter: showTitle || !hideFooter, | ||
headerTemplate: showTitle ? `<div style="font-size: 9px; font-family: '宋体'; color: #333; padding: 5px; margin-left: 0.6cm;"> <span class="title"></span> </div>` : `<div></div>`, | ||
footerTemplate: hideFooter ? `<div></div>` : `<div style="font-size: 9px; font-family: '宋体'; color: #333; padding: 5px; margin: 0 auto;">第 <span class="pageNumber"></span> 页 / 共 <span class="totalPages"></span> 页</div>`, | ||
headerTemplate: showTitle ? `<div style="font-size: 9px; font-family: 'SimSun'; color: #333; padding: 5px; margin-left: 0.6cm;"> <span class="title"></span> </div>` : `<div></div>`, | ||
footerTemplate: hideFooter ? `<div></div>` : `<div style="font-size: 9px; font-family: 'SimSun'; color: #333; padding: 5px; margin: 0 auto;">第 <span class="pageNumber"></span> 页 / 共 <span class="totalPages"></span> 页</div>`, | ||
} | ||
|
||
} | ||
|