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