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