blob: d5243acaf03c63c8937834ad9a9584ee5a4b64b6 [file] [log] [blame] [view]
David Pursehouse240fbff2016-08-25 09:58:15 +09001# Configuration
2
3The `gitiles.config` file supporting the site contains several configuration
4options.
5
6[TOC]
7
David Pursehousef7018102016-08-25 10:10:23 +09008## Core configuration
9
Antoine Musso0b4abb42022-06-30 22:12:26 +020010### Site Title
11
12The title of the site. Default: `Gitiles`.
13
14```
15[gitiles]
16 siteTitle = Acme Inc. Git Browser
17```
18
Dave Borowitzed97b7f2022-06-30 20:28:03 +020019### Fixed time zone
20
21By default dates are formatted including the local user time zone as that
22matches git tools. Some users/administrators may prefer normalizing to a
23particular timezone so times are directly comparable without doing timezone
24arithmetic.
25
26Setting `fixedTimeZone` to a valid Java TimeZone ID causes all dates in the UI
27to be implicitly converted to this timezone, and the now-redundant timezone
28offset to be dropped from the output.
29
30```
31[gitiles]
32 fixedTimeZone = UTC
33```
34
David Pursehousef7018102016-08-25 10:10:23 +090035### Cross-Origin Resource Sharing (CORS)
36
37Gitiles sets the `Access-Control-Allow-Origin` header to the
38HTTP origin of the client if the client's domain matches a regular
39expression defined in `allowOriginRegex`.
40
41```
42[gitiles]
43 allowOriginRegex = http://localhost
44```
45
46By default `allowOriginRegex` is unset, denying all cross-origin requests.
47
David Pursehouse240fbff2016-08-25 09:58:15 +090048## Markdown
49
50### Disabling markdown
51
52Markdown can be completely disabled by setting render to false.
53
54```
55[markdown]
56 render = false
57```
58
59### Markdown size
60
61Markdown files are limited by default to 5 MiB of input text
62per file. This limit is configurable, but should not be raised
63beyond available memory.
64
65```
66[markdown]
67 inputLimit = 5M
68```
69
70### Image size
71
72Referenced [images are inlined](#Images) as base64 encoded URIs.
73The image limit places an upper bound on the byte size of input.
74
75```
76[markdown]
77 imageLimit = 256K
78```
79
Shawn Pearceb55cf2b2017-06-29 21:56:37 -070080### Extensions
81
82The following extensions can be enabled/disabled in the markdown
83section:
84
85* `githubFlavor`: enable extensions that mirror GitHub Flavor
86 Markdown behavior. Default is true.
87
88* `autolink`: automatically convert plain URLs and email
David Pursehouse0c122622017-07-02 13:33:58 +090089 addresses into links. Default follows `githubFlavor`.
Shawn Pearceb55cf2b2017-06-29 21:56:37 -070090
91* `blocknote`: Gitiles style note/promo/aside blocks to raise
92 awareness to important content. Default false.
93
94* `ghthematicbreak`: accept `--` for `<hr>`, like GitHub Flavor
95 Markdown. Default follows `githubFlavor`.
96
97* `multicolumn`: Gitiles extension to layout content in a 12 cell
98 grid, delinated by section headers. Default false.
99
100* `namedanchor`: Gitiles extension to extract named anchors using
101 `#{id}` syntax. Default false.
102
103* `safehtml`: Gitiles extension to accept very limited HTML; for
104 security reasons all other HTML is dropped regardless of this
105 setting. Default follows `githubFlavor`.
106
107* `smartquote`: Gitiles extension to convert single and double quote
108 ASCII characters to Unicode smart quotes when in prose. Default
109 false.
110
111* `strikethrough`: strikethrough text with GitHub Flavor Markdown
112 style `~~`. Default follows `githubFlavor`.
113
114* `tables`: format tables with GitHub Flavor Markdown. Default
115 follows `githubFlavor`.
116
117* `toc`: Gitiles extension to replace `[TOC]` in a paragraph by itself
118 with a server-side generated table of contents extracted from section
119 headers. Default true.
120
David Pursehousebbcc5132016-08-26 13:26:13 +0900121### IFrames
122
Shawn Pearceb55cf2b2017-06-29 21:56:37 -0700123IFrame support requires `markdown.safehtml` to be true.
124
David Pursehousebbcc5132016-08-26 13:26:13 +0900125IFrame source URLs can be whitelisted by providing a list of allowed
126URLs. URLs ending with a `/` are treated as prefixes, allowing any source
127URL beginning with that prefix.
128
129```
130[markdown]
131 allowiframe = https://google.com/
132```
133
134URLs not ending with a `/` are treated as exact matches, and only those
135source URLs will be allowed.
136
137
138```
139[markdown]
140 allowiframe = https://example.com
141 allowiframe = https://example.org
142```
143
144If the list has a single entry with the value `true`, all source URLs
145will be allowed.
146
147
148```
149[markdown]
150 allowiframe = true
151```
152
David Pursehouse240fbff2016-08-25 09:58:15 +0900153## Google Analytics
154
155[Google Analytics](https://www.google.com/analytics/) can be
156enabled on every rendered markdown page by adding the Property ID
157to the configuration file:
158
159```
160[google]
161 analyticsId = UA-XXXX-Y
162```