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