Skip to content

Commit b5c83cc

Browse files
committed
fix: 修复docx下图片路径计算错误
1 parent 5e91213 commit b5c83cc

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

build.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ var output = '# ' + book.title + '\n\n';
1111

1212
var contentArr = summary.match(/\(.*\)/g).map(function (path) {
1313
path = path.slice(1).slice(0, -1);
14-
return fs.readFileSync('./' + path).toString();
14+
var res = fs.readFileSync('./' + path).toString();
15+
// pandoc 图片路径修复
16+
res = res.replace('](/img/', '](./img/');
17+
return res;
1518
});
1619

1720
output += contentArr.join('\n\n');

chapter/markdown.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
下面是一张图片
4747

48-
![图片](/img/facebook.png)
48+
![图片描述](/img/facebook.png)
4949

5050
脚注[^6]脚注脚注
5151

gitbook-boilerplate.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
下面是一张图片
5757

58-
![图片](/img/facebook.png)
58+
![图片描述](./img/facebook.png)
5959

6060
脚注[^6]脚注脚注
6161

0 commit comments

Comments
 (0)