@@ -42,8 +42,8 @@ export class ImportService {
42
42
// 修正文件名
43
43
const originalFilename = fromFilename . substring ( 0 , fromFilename . lastIndexOf ( "." ) )
44
44
// 去除标题多余的空格,包括开始中间以及结尾的空格
45
- const filename = originalFilename . replace ( / \s + / g, "" )
46
- const toFilename = `${ filename } .md`
45
+ // const filename = originalFilename.replace(/\s+/g, "")
46
+ const toFilename = `${ originalFilename } .md`
47
47
48
48
// 扩展名
49
49
const ext = fromFilename . split ( "." ) . pop ( ) . toLowerCase ( )
@@ -69,7 +69,7 @@ export class ImportService {
69
69
const fullDirPath = path . join ( dirPath , `${ originalFilename } _files` )
70
70
pluginInstance . logger . info ( "fullDirPath=>" , fullDirPath )
71
71
72
- await copyDir ( fullDirPath , `${ workspaceDir } /temp/convert/pandoc/${ filename } _files` )
72
+ await copyDir ( fullDirPath , `${ workspaceDir } /temp/convert/pandoc/${ originalFilename } _files` )
73
73
}
74
74
}
75
75
@@ -90,32 +90,7 @@ export class ImportService {
90
90
}
91
91
92
92
// 文件转换
93
- const args : string [ ] = [
94
- "--to" ,
95
- "markdown_strict-raw_html" ,
96
- fromFilename ,
97
- "-o" ,
98
- toFilename ,
99
- "--extract-media" ,
100
- `${ mediaDir } /${ shortHash ( fromFilename ) . toLowerCase ( ) } ` ,
101
- "--wrap=none" ,
102
- ]
103
- // const args = [
104
- // "--to",
105
- // "markdown_strict-raw_html",
106
- // fromFilename,
107
- // "-o",
108
- // toFilename,
109
- // "--extract-media",
110
- // `${mediaDir}/${shortHash(fromFilename).toLowerCase()}`,
111
- // "--wrap=none",
112
- // ]
113
- const convertResult = await pluginInstance . kernelApi . convertPandocCustom ( args )
114
- // const convertResult = await pluginInstance.kernelApi.convertPandoc(
115
- // "markdown_strict-raw_html",
116
- // fromFilename,
117
- // toFilename
118
- // )
93
+ const convertResult = await pluginInstance . kernelApi . convertPandoc ( fromFilename , toFilename )
119
94
if ( convertResult . code !== 0 ) {
120
95
showMessage ( `${ pluginInstance . i18n . msgFileConvertError } :${ convertResult . msg } ` , 7000 , "error" )
121
96
return
0 commit comments