blob: 8273617e6f2797dc575fab79ebc1fcdba1e73e04 [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
10### Cross-Origin Resource Sharing (CORS)
11
12Gitiles sets the `Access-Control-Allow-Origin` header to the
13HTTP origin of the client if the client's domain matches a regular
14expression defined in `allowOriginRegex`.
15
16```
17[gitiles]
18 allowOriginRegex = http://localhost
19```
20
21By default `allowOriginRegex` is unset, denying all cross-origin requests.
22
Antoine Musso07e21422022-06-30 22:14:59 +020023### Gitweb redirector
24
25Redirect requests to old gitweb URLs after having migrated to Gitiles. Matching
26URLs will be redirected permanently to their Gitiles equivalent.
27Default: `true`.
28
29```
30[gitiles]
31redirectGitweb = false
32```
33
David Pursehouse240fbff2016-08-25 09:58:15 +090034## Markdown
35
36### Disabling markdown
37
38Markdown can be completely disabled by setting render to false.
39
40```
41[markdown]
42 render = false
43```
44
45### Markdown size
46
47Markdown files are limited by default to 5 MiB of input text
48per file. This limit is configurable, but should not be raised
49beyond available memory.
50
51```
52[markdown]
53 inputLimit = 5M
54```
55
56### Image size
57
58Referenced [images are inlined](#Images) as base64 encoded URIs.
59The image limit places an upper bound on the byte size of input.
60
61```
62[markdown]
63 imageLimit = 256K
64```
65
Shawn Pearceb55cf2b2017-06-29 21:56:37 -070066### Extensions
67
68The following extensions can be enabled/disabled in the markdown
69section:
70
71* `githubFlavor`: enable extensions that mirror GitHub Flavor
72 Markdown behavior. Default is true.
73
74* `autolink`: automatically convert plain URLs and email
David Pursehouse0c122622017-07-02 13:33:58 +090075 addresses into links. Default follows `githubFlavor`.
Shawn Pearceb55cf2b2017-06-29 21:56:37 -070076
77* `blocknote`: Gitiles style note/promo/aside blocks to raise
78 awareness to important content. Default false.
79
80* `ghthematicbreak`: accept `--` for `<hr>`, like GitHub Flavor
81 Markdown. Default follows `githubFlavor`.
82
83* `multicolumn`: Gitiles extension to layout content in a 12 cell
84 grid, delinated by section headers. Default false.
85
86* `namedanchor`: Gitiles extension to extract named anchors using
87 `#{id}` syntax. Default false.
88
89* `safehtml`: Gitiles extension to accept very limited HTML; for
90 security reasons all other HTML is dropped regardless of this
91 setting. Default follows `githubFlavor`.
92
93* `smartquote`: Gitiles extension to convert single and double quote
94 ASCII characters to Unicode smart quotes when in prose. Default
95 false.
96
97* `strikethrough`: strikethrough text with GitHub Flavor Markdown
98 style `~~`. Default follows `githubFlavor`.
99
100* `tables`: format tables with GitHub Flavor Markdown. Default
101 follows `githubFlavor`.
102
103* `toc`: Gitiles extension to replace `[TOC]` in a paragraph by itself
104 with a server-side generated table of contents extracted from section
105 headers. Default true.
106
David Pursehousebbcc5132016-08-26 13:26:13 +0900107### IFrames
108
Shawn Pearceb55cf2b2017-06-29 21:56:37 -0700109IFrame support requires `markdown.safehtml` to be true.
110
David Pursehousebbcc5132016-08-26 13:26:13 +0900111IFrame source URLs can be whitelisted by providing a list of allowed
112URLs. URLs ending with a `/` are treated as prefixes, allowing any source
113URL beginning with that prefix.
114
115```
116[markdown]
117 allowiframe = https://google.com/
118```
119
120URLs not ending with a `/` are treated as exact matches, and only those
121source URLs will be allowed.
122
123
124```
125[markdown]
126 allowiframe = https://example.com
127 allowiframe = https://example.org
128```
129
130If the list has a single entry with the value `true`, all source URLs
131will be allowed.
132
133
134```
135[markdown]
136 allowiframe = true
137```
138
David Pursehouse240fbff2016-08-25 09:58:15 +0900139## Google Analytics
140
141[Google Analytics](https://www.google.com/analytics/) can be
142enabled on every rendered markdown page by adding the Property ID
143to the configuration file:
144
145```
146[google]
147 analyticsId = UA-XXXX-Y
148```