summaryrefslogtreecommitdiffstats
path: root/lib/constants/configSchema.js
blob: d2126c6dac54a076d6ae52b6e0a281a020cf4983 (plain)
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
var FILENAME_REGEX = '^[a-zA-Z-._\d,\s]+$';

module.exports = {
    '$schema': 'http://json-schema.org/schema#',
    'id': 'https://gitbook.com/schemas/book.json',
    'title': 'GitBook Configuration',
    'type': 'object',
    'properties': {
        'root': {
            'type': 'string',
            'title': 'Path fro the root folder containing the book\'s content'
        },
        'title': {
            'type': 'string',
            'title': 'Title of the book, default is extracted from README'
        },
        'isbn': {
            'type': 'string',
            'title': 'ISBN for published book'
        },
        'language': {
            'type': 'string',
            'title': 'Language of the book'
        },
        'author': {
            'type': 'string',
            'title': 'Name of the author'
        },
        'gitbook': {
            'type': 'string',
            'default': '*',
            'title': 'GitBook version to match'
        },
        'direction': {
            'type': 'string',
            'enum': ['ltr', 'rtl'],
            'title': 'Direction of texts, default is detected in the pages'
        },
        'theme': {
            'type': 'string',
            'default': 'default',
            'title': 'Name of the theme plugin to use'
        },
        'variables': {
            'type': 'object',
            'title': 'Templating context variables'
        },
        'plugins': {
            'oneOf': [
                { '$ref': '#/definitions/pluginsArray' },
                { '$ref': '#/definitions/pluginsString' }
            ],
            'default': []
        },
        'pluginsConfig': {
            'type': 'object',
            'title': 'Configuration for plugins'
        },
        'structure': {
            'type': 'object',
            'properties': {
                'langs': {
                    'default': 'LANGS.md',
                    'type': 'string',
                    'title': 'File to use as languages index',
                    'pattern': FILENAME_REGEX
                },
                'readme': {
                    'default': 'README.md',
                    'type': 'string',
                    'title': 'File to use as preface',
                    'pattern': FILENAME_REGEX
                },
                'glossary': {
                    'default': 'GLOSSARY.md',
                    'type': 'string',
                    'title': 'File to use as glossary index',
                    'pattern': FILENAME_REGEX
                },
                'summary': {
                    'default': 'SUMMARY.md',
                    'type': 'string',
                    'title': 'File to use as table of contents',
                    'pattern': FILENAME_REGEX
                }
            },
            'additionalProperties': false
        },
        'pdf': {
            'type': 'object',
            'title': 'PDF specific configurations',
            'properties': {
                'pageNumbers': {
                    'type': 'boolean',
                    'default': true,
                    'title': 'Add page numbers to the bottom of every page'
                },
                'fontSize': {
                    'type': 'integer',
                    'minimum': 8,
                    'maximum': 30,
                    'default': 12,
                    'title': 'Font size for the PDF output'
                },
                'fontFamily': {
                    'type': 'string',
                    'default': 'Arial',
                    'title': 'Font family for the PDF output'
                },
                'paperSize': {
                    'type': 'string',
                    'enum': ['a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'legal', 'letter'],
                    'default': 'a4',
                    'title': 'Paper size for the PDF'
                },
                'chapterMark': {
                    'type': 'string',
                    'enum': ['pagebreak', 'rule', 'both', 'none'],
                    'default': 'pagebreak',
                    'title': 'How to mark detected chapters'
                },
                'pageBreaksBefore': {
                    'type': 'string',
                    'default': '/',
                    'title': 'An XPath expression. Page breaks are inserted before the specified elements. To disable use the expression: "/"'
                },
                'margin': {
                    'type': 'object',
                    'properties': {
                        'right': {
                            'type': 'integer',
                            'title': 'Right Margin',
                            'minimum': 0,
                            'maximum': 100,
                            'default': 62
                        },
                        'left': {
                            'type': 'integer',
                            'title': 'Left Margin',
                            'minimum': 0,
                            'maximum': 100,
                            'default': 62
                        },
                        'top': {
                            'type': 'integer',
                            'title': 'Top Margin',
                            'minimum': 0,
                            'maximum': 100,
                            'default': 56
                        },
                        'bottom': {
                            'type': 'integer',
                            'title': 'Bottom Margin',
                            'minimum': 0,
                            'maximum': 100,
                            'default': 56
                        }
                    }
                }
            }
        }
    },
    'required': [],
    'definitions': {
        'pluginsArray': {
            'type': 'array',
            'items': {
                'oneOf': [
                    { '$ref': '#/definitions/pluginObject' },
                    { '$ref': '#/definitions/pluginString' }
                ]
            }
        },
        'pluginsString': {
            'type': 'string'
        },
        'pluginString': {
            'type': 'string'
        },
        'pluginObject': {
            'type': 'object',
            'properties': {
                'name': {
                    'type': 'string'
                },
                'version': {
                    'type': 'string'
                }
            },
            'additionalProperties': false,
            'required': ['name']
        }
    }
};