-
-
Notifications
You must be signed in to change notification settings - Fork 103
/
config.ts
111 lines (96 loc) · 2.2 KB
/
config.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
import { resolve } from 'path';
import { MarkedOptions } from 'marked';
import { PDFOptions, LaunchOptions } from 'puppeteer';
export const defaultConfig: Config = {
basedir: process.cwd(),
stylesheet: [resolve(__dirname, '..', '..', 'markdown.css')],
css: '',
body_class: [],
highlight_style: 'github',
marked_options: {},
pdf_options: {
printBackground: true,
format: 'A4',
margin: {
top: '30mm',
right: '40mm',
bottom: '30mm',
left: '20mm',
},
},
launch_options: {},
md_file_encoding: 'utf-8',
stylesheet_encoding: 'utf-8',
as_html: false,
devtools: false,
};
/**
* In config keys, dashes of cli flag names are replaced with underscores.
*/
export interface Config {
/**
* Base directory to be served by the file server.
*/
basedir: string;
/**
* Optional destination path for the output file (including the extension).
*/
dest?: string;
/**
* List of css files to use for styling.
*/
stylesheet: string[];
/**
* Custom css styles.
*/
css: string;
/**
* List of classes for the body tag.
*/
body_class: string[];
/**
* Highlight.js stylesheet to use (without the .css extension).
*
* @see https://github.com/isagalaev/highlight.js/tree/master/src/styles
*/
highlight_style: string;
/**
* Options for the Marked parser.
*
* @see https://marked.js.org/#/USING_ADVANCED.md
*/
marked_options: MarkedOptions;
/**
* PDF options for Puppeteer.
*
* @see https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions
*/
pdf_options: PDFOptions;
/**
* Launch options for Puppeteer.
*
* @see https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions
*/
launch_options: LaunchOptions;
/**
* Markdown file encoding. Default: `utf-8`.
*/
md_file_encoding: string;
/**
* CSS stylesheet encoding. Default: `utf-8`.
*/
stylesheet_encoding: string;
/**
* If true, generate HTML output instead of PDF output. Default: `false`.
*/
as_html: boolean;
/**
* If true, open chromium with devtools instead of saving the pdf. This is
* meant for development only, to inspect the rendered HTML.
*/
devtools: boolean;
/**
* Port to run the local server on.
*/
port?: number;
}