-
Notifications
You must be signed in to change notification settings - Fork 19
/
export_templates.ts
141 lines (139 loc) · 5.52 KB
/
export_templates.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import type { ExportSetting } from './settings';
/*
* Variables
* - ${attachmentFolderPath} --> obsidian' settings.
*
* /User/aaa/Documents/test.pdf
* - ${outputDir} --> /User/aaa/Documents/
* - ${outputPath} --> /User/aaa/Documents/test.pdf
* - ${outputFileName} --> test
* - ${outputFileFullName} --> test.pdf
*
* /User/aaa/Documents/test.pdf
* - ${currentDir} --> /User/aaa/Documents/
* - ${currentPath} --> /User/aaa/Documents/test.pdf
* - ${currentFileName} --> test
* - ${CurrentFileFullName} --> test.pdf
*/
export default {
'Markdown': {
name: 'Markdown',
type: 'pandoc',
arguments:
'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown.lua" -s -o "${outputPath}" -t commonmark_x-attributes',
extension: '.md',
},
'Markdown (Hugo)': {
name: 'Markdown (Hugo)',
type: 'pandoc',
arguments:
'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown+hugo.lua" -s -o "${outputPath}" -t commonmark_x-attributes',
extension: '.md',
},
'Html': {
name: 'Html',
type: 'pandoc',
arguments:
'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/math_block.lua" --embed-resources --standalone --metadata title="${currentFileName}" -s -o "${outputPath}" -t html',
customArguments: '--mathjax="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg-full.js"',
extension: '.html',
},
'TextBundle': {
name: 'TextBundle',
type: 'pandoc',
arguments:
'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown.lua" -V media_dir="${outputDir}/${outputFileName}.textbundle/assets" -s -o "${outputDir}/${outputFileName}.textbundle/text.md" -t commonmark_x-attributes',
extension: '.md',
},
'Typst': {
name: 'Typst',
type: 'pandoc',
arguments:
'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown.lua" -s -o "${outputPath}" -t typst',
extension: '.typ',
},
'PDF': {
name: 'PDF',
type: 'pandoc',
arguments:
'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/pdf.lua" ${ options.textemplate ? `--resource-path="${pluginDir}/textemplate" --template="${options.textemplate}"` : ` ` } -o "${outputPath}" -t pdf',
customArguments: '--pdf-engine=pdflatex',
optionsMeta: {
'textemplate': 'preset:textemplate', // reference from `PresetOptionsMeta` in `src/settings.ts`
},
extension: '.pdf',
},
'Word (.docx)': {
name: 'Word (.docx)',
type: 'pandoc',
arguments: '-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -o "${outputPath}" -t docx',
extension: '.docx',
},
'OpenOffice': {
name: 'OpenOffice',
type: 'pandoc',
arguments: '-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -o "${outputPath}" -t odt',
extension: '.odt',
},
'RTF': {
name: 'RTF',
type: 'pandoc',
arguments: '-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t rtf',
extension: '.rtf',
},
'Epub': {
name: 'Epub',
type: 'pandoc',
arguments: '-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -o "${outputPath}" -t epub',
extension: '.epub',
},
'Latex': {
name: 'Latex',
type: 'pandoc',
arguments:
'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" ${ options.textemplate ? `--resource-path="${pluginDir}/textemplate" --template="${options.textemplate}"` : ` ` } --extract-media="${outputDir}" -s -o "${outputPath}" -t latex',
optionsMeta: {
'textemplate': 'preset:textemplate', // reference from `PresetOptionsMeta` in `src/settings.ts`
},
extension: '.tex',
},
'Media Wiki': {
name: 'Media Wiki',
type: 'pandoc',
arguments:
'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t mediawiki',
extension: '.mediawiki',
},
'reStructuredText': {
name: 'reStructuredText',
type: 'pandoc',
arguments: '-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t rst',
extension: '.rst',
},
'Textile': {
name: 'Textile',
type: 'pandoc',
arguments:
'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t textile',
extension: '.textile',
},
'OPML': {
name: 'OPML',
type: 'pandoc',
arguments: '-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t opml',
extension: '.opml',
},
'Bibliography (.bib)': {
name: 'Bibliography',
type: 'pandoc',
arguments:
'-f ${fromFormat} --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/citefilter.lua" -o "${outputPath}" --to=bibtex "${currentPath}"',
extension: '.bib',
},
'Custom': {
name: 'Custom',
type: 'custom',
command: 'your command',
targetFileExtensions: '.ext',
},
} satisfies Record<string, ExportSetting> as Record<string, ExportSetting>;