| 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 | |
| Dave Borowitz | ed97b7f | 2022-06-30 20:28:03 +0200 | [diff] [blame^] | 10 | ### Fixed time zone |
| 11 | |
| 12 | By default dates are formatted including the local user time zone as that |
| 13 | matches git tools. Some users/administrators may prefer normalizing to a |
| 14 | particular timezone so times are directly comparable without doing timezone |
| 15 | arithmetic. |
| 16 | |
| 17 | Setting `fixedTimeZone` to a valid Java TimeZone ID causes all dates in the UI |
| 18 | to be implicitly converted to this timezone, and the now-redundant timezone |
| 19 | offset to be dropped from the output. |
| 20 | |
| 21 | ``` |
| 22 | [gitiles] |
| 23 | fixedTimeZone = UTC |
| 24 | ``` |
| 25 | |
| David Pursehouse | f701810 | 2016-08-25 10:10:23 +0900 | [diff] [blame] | 26 | ### Cross-Origin Resource Sharing (CORS) |
| 27 | |
| 28 | Gitiles sets the `Access-Control-Allow-Origin` header to the |
| 29 | HTTP origin of the client if the client's domain matches a regular |
| 30 | expression defined in `allowOriginRegex`. |
| 31 | |
| 32 | ``` |
| 33 | [gitiles] |
| 34 | allowOriginRegex = http://localhost |
| 35 | ``` |
| 36 | |
| 37 | By default `allowOriginRegex` is unset, denying all cross-origin requests. |
| 38 | |
| David Pursehouse | 240fbff | 2016-08-25 09:58:15 +0900 | [diff] [blame] | 39 | ## Markdown |
| 40 | |
| 41 | ### Disabling markdown |
| 42 | |
| 43 | Markdown can be completely disabled by setting render to false. |
| 44 | |
| 45 | ``` |
| 46 | [markdown] |
| 47 | render = false |
| 48 | ``` |
| 49 | |
| 50 | ### Markdown size |
| 51 | |
| 52 | Markdown files are limited by default to 5 MiB of input text |
| 53 | per file. This limit is configurable, but should not be raised |
| 54 | beyond available memory. |
| 55 | |
| 56 | ``` |
| 57 | [markdown] |
| 58 | inputLimit = 5M |
| 59 | ``` |
| 60 | |
| 61 | ### Image size |
| 62 | |
| 63 | Referenced [images are inlined](#Images) as base64 encoded URIs. |
| 64 | The image limit places an upper bound on the byte size of input. |
| 65 | |
| 66 | ``` |
| 67 | [markdown] |
| 68 | imageLimit = 256K |
| 69 | ``` |
| 70 | |
| Shawn Pearce | b55cf2b | 2017-06-29 21:56:37 -0700 | [diff] [blame] | 71 | ### Extensions |
| 72 | |
| 73 | The following extensions can be enabled/disabled in the markdown |
| 74 | section: |
| 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 Pursehouse | 0c12262 | 2017-07-02 13:33:58 +0900 | [diff] [blame] | 80 | addresses into links. Default follows `githubFlavor`. |
| Shawn Pearce | b55cf2b | 2017-06-29 21:56:37 -0700 | [diff] [blame] | 81 | |
| 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 Pursehouse | bbcc513 | 2016-08-26 13:26:13 +0900 | [diff] [blame] | 112 | ### IFrames |
| 113 | |
| Shawn Pearce | b55cf2b | 2017-06-29 21:56:37 -0700 | [diff] [blame] | 114 | IFrame support requires `markdown.safehtml` to be true. |
| 115 | |
| David Pursehouse | bbcc513 | 2016-08-26 13:26:13 +0900 | [diff] [blame] | 116 | IFrame source URLs can be whitelisted by providing a list of allowed |
| 117 | URLs. URLs ending with a `/` are treated as prefixes, allowing any source |
| 118 | URL beginning with that prefix. |
| 119 | |
| 120 | ``` |
| 121 | [markdown] |
| 122 | allowiframe = https://google.com/ |
| 123 | ``` |
| 124 | |
| 125 | URLs not ending with a `/` are treated as exact matches, and only those |
| 126 | source URLs will be allowed. |
| 127 | |
| 128 | |
| 129 | ``` |
| 130 | [markdown] |
| 131 | allowiframe = https://example.com |
| 132 | allowiframe = https://example.org |
| 133 | ``` |
| 134 | |
| 135 | If the list has a single entry with the value `true`, all source URLs |
| 136 | will be allowed. |
| 137 | |
| 138 | |
| 139 | ``` |
| 140 | [markdown] |
| 141 | allowiframe = true |
| 142 | ``` |
| 143 | |
| David Pursehouse | 240fbff | 2016-08-25 09:58:15 +0900 | [diff] [blame] | 144 | ## Google Analytics |
| 145 | |
| 146 | [Google Analytics](https://www.google.com/analytics/) can be |
| 147 | enabled on every rendered markdown page by adding the Property ID |
| 148 | to the configuration file: |
| 149 | |
| 150 | ``` |
| 151 | [google] |
| 152 | analyticsId = UA-XXXX-Y |
| 153 | ``` |