| David Pursehouse | 240fbff | 2016-08-25 09:58:15 +0900 | [diff] [blame] | 1 | # Configuration |
| 2 | |
| 3 | The `gitiles.config` file supporting the site contains several configuration |
| 4 | options. |
| 5 | |
| 6 | [TOC] |
| 7 | |
| David Pursehouse | f701810 | 2016-08-25 10:10:23 +0900 | [diff] [blame] | 8 | ## Core configuration |
| 9 | |
| Antoine Musso | 0b4abb4 | 2022-06-30 22:12:26 +0200 | [diff] [blame] | 10 | ### Site Title |
| 11 | |
| 12 | The title of the site. Default: `Gitiles`. |
| 13 | |
| 14 | ``` |
| 15 | [gitiles] |
| 16 | siteTitle = Acme Inc. Git Browser |
| 17 | ``` |
| 18 | |
| Antoine Musso | 68f511a | 2022-06-30 22:13:36 +0200 | [diff] [blame] | 19 | ### URLs |
| 20 | |
| 21 | `canonicalHostName`. |
| 22 | Default: `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 |
| 27 | messages. If you are using the Gerrit Gitiles plugin, this is set based on |
| 28 | Gerrit's configuration. |
| 29 | Default: `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 | |
| Antoine Musso | 33d4c13 | 2022-06-30 22:14:13 +0200 | [diff] [blame^] | 38 | ### Repositories export |
| 39 | |
| 40 | Set `exportAll` to instruct jGit to export all repositories, ignoring the check |
| 41 | for existence of `git-daemon-export-ok` file at the root of the repository. |
| 42 | |
| 43 | Default: `false`, repositories need to be explicitly marked for export. |
| 44 | |
| 45 | ``` |
| 46 | [gitiles] |
| 47 | exportAll = true |
| 48 | ``` |
| 49 | |
| Dave Borowitz | ed97b7f | 2022-06-30 20:28:03 +0200 | [diff] [blame] | 50 | ### Fixed time zone |
| 51 | |
| 52 | By default dates are formatted including the local user time zone as that |
| 53 | matches git tools. Some users/administrators may prefer normalizing to a |
| 54 | particular timezone so times are directly comparable without doing timezone |
| 55 | arithmetic. |
| 56 | |
| 57 | Setting `fixedTimeZone` to a valid Java TimeZone ID causes all dates in the UI |
| 58 | to be implicitly converted to this timezone, and the now-redundant timezone |
| 59 | offset to be dropped from the output. |
| 60 | |
| 61 | ``` |
| 62 | [gitiles] |
| 63 | fixedTimeZone = UTC |
| 64 | ``` |
| 65 | |
| David Pursehouse | f701810 | 2016-08-25 10:10:23 +0900 | [diff] [blame] | 66 | ### Cross-Origin Resource Sharing (CORS) |
| 67 | |
| 68 | Gitiles sets the `Access-Control-Allow-Origin` header to the |
| 69 | HTTP origin of the client if the client's domain matches a regular |
| 70 | expression defined in `allowOriginRegex`. |
| 71 | |
| 72 | ``` |
| 73 | [gitiles] |
| 74 | allowOriginRegex = http://localhost |
| 75 | ``` |
| 76 | |
| 77 | By default `allowOriginRegex` is unset, denying all cross-origin requests. |
| 78 | |
| David Pursehouse | 240fbff | 2016-08-25 09:58:15 +0900 | [diff] [blame] | 79 | ## Markdown |
| 80 | |
| 81 | ### Disabling markdown |
| 82 | |
| 83 | Markdown can be completely disabled by setting render to false. |
| 84 | |
| 85 | ``` |
| 86 | [markdown] |
| 87 | render = false |
| 88 | ``` |
| 89 | |
| 90 | ### Markdown size |
| 91 | |
| 92 | Markdown files are limited by default to 5 MiB of input text |
| 93 | per file. This limit is configurable, but should not be raised |
| 94 | beyond available memory. |
| 95 | |
| 96 | ``` |
| 97 | [markdown] |
| 98 | inputLimit = 5M |
| 99 | ``` |
| 100 | |
| 101 | ### Image size |
| 102 | |
| 103 | Referenced [images are inlined](#Images) as base64 encoded URIs. |
| 104 | The image limit places an upper bound on the byte size of input. |
| 105 | |
| 106 | ``` |
| 107 | [markdown] |
| 108 | imageLimit = 256K |
| 109 | ``` |
| 110 | |
| Shawn Pearce | b55cf2b | 2017-06-29 21:56:37 -0700 | [diff] [blame] | 111 | ### Extensions |
| 112 | |
| 113 | The following extensions can be enabled/disabled in the markdown |
| 114 | section: |
| 115 | |
| 116 | * `githubFlavor`: enable extensions that mirror GitHub Flavor |
| 117 | Markdown behavior. Default is true. |
| 118 | |
| 119 | * `autolink`: automatically convert plain URLs and email |
| David Pursehouse | 0c12262 | 2017-07-02 13:33:58 +0900 | [diff] [blame] | 120 | addresses into links. Default follows `githubFlavor`. |
| Shawn Pearce | b55cf2b | 2017-06-29 21:56:37 -0700 | [diff] [blame] | 121 | |
| 122 | * `blocknote`: Gitiles style note/promo/aside blocks to raise |
| 123 | awareness to important content. Default false. |
| 124 | |
| 125 | * `ghthematicbreak`: accept `--` for `<hr>`, like GitHub Flavor |
| 126 | Markdown. Default follows `githubFlavor`. |
| 127 | |
| 128 | * `multicolumn`: Gitiles extension to layout content in a 12 cell |
| 129 | grid, delinated by section headers. Default false. |
| 130 | |
| 131 | * `namedanchor`: Gitiles extension to extract named anchors using |
| 132 | `#{id}` syntax. Default false. |
| 133 | |
| 134 | * `safehtml`: Gitiles extension to accept very limited HTML; for |
| 135 | security reasons all other HTML is dropped regardless of this |
| 136 | setting. Default follows `githubFlavor`. |
| 137 | |
| 138 | * `smartquote`: Gitiles extension to convert single and double quote |
| 139 | ASCII characters to Unicode smart quotes when in prose. Default |
| 140 | false. |
| 141 | |
| 142 | * `strikethrough`: strikethrough text with GitHub Flavor Markdown |
| 143 | style `~~`. Default follows `githubFlavor`. |
| 144 | |
| 145 | * `tables`: format tables with GitHub Flavor Markdown. Default |
| 146 | follows `githubFlavor`. |
| 147 | |
| 148 | * `toc`: Gitiles extension to replace `[TOC]` in a paragraph by itself |
| 149 | with a server-side generated table of contents extracted from section |
| 150 | headers. Default true. |
| 151 | |
| David Pursehouse | bbcc513 | 2016-08-26 13:26:13 +0900 | [diff] [blame] | 152 | ### IFrames |
| 153 | |
| Shawn Pearce | b55cf2b | 2017-06-29 21:56:37 -0700 | [diff] [blame] | 154 | IFrame support requires `markdown.safehtml` to be true. |
| 155 | |
| David Pursehouse | bbcc513 | 2016-08-26 13:26:13 +0900 | [diff] [blame] | 156 | IFrame source URLs can be whitelisted by providing a list of allowed |
| 157 | URLs. URLs ending with a `/` are treated as prefixes, allowing any source |
| 158 | URL beginning with that prefix. |
| 159 | |
| 160 | ``` |
| 161 | [markdown] |
| 162 | allowiframe = https://google.com/ |
| 163 | ``` |
| 164 | |
| 165 | URLs not ending with a `/` are treated as exact matches, and only those |
| 166 | source URLs will be allowed. |
| 167 | |
| 168 | |
| 169 | ``` |
| 170 | [markdown] |
| 171 | allowiframe = https://example.com |
| 172 | allowiframe = https://example.org |
| 173 | ``` |
| 174 | |
| 175 | If the list has a single entry with the value `true`, all source URLs |
| 176 | will be allowed. |
| 177 | |
| 178 | |
| 179 | ``` |
| 180 | [markdown] |
| 181 | allowiframe = true |
| 182 | ``` |
| 183 | |
| David Pursehouse | 240fbff | 2016-08-25 09:58:15 +0900 | [diff] [blame] | 184 | ## Google Analytics |
| 185 | |
| 186 | [Google Analytics](https://www.google.com/analytics/) can be |
| 187 | enabled on every rendered markdown page by adding the Property ID |
| 188 | to the configuration file: |
| 189 | |
| 190 | ``` |
| 191 | [google] |
| 192 | analyticsId = UA-XXXX-Y |
| 193 | ``` |