diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md index 8d0412f3b8453c..84564e3040ac23 100644 --- a/docs/usage/configuration-options.md +++ b/docs/usage/configuration-options.md @@ -1294,7 +1294,7 @@ Users can define custom managers for cases such as: The custom manager concept is based on using Regular Expression named capture groups. For the fields `datasource`, `depName` and `currentValue`, it's mandatory to have either a named capture group matching them (e.g. `(?.*)`) or to configure it's corresponding template (e.g. `depNameTemplate`). It's not recommended to do both, due to the potential for confusion. It is recommended to also include `versioning` however if it is missing then it will default to `semver`. -For more details and examples, see the documentation page the for the regex manager [here](/modules/manager/regex/). +For more details and examples, see the documentation page the for the regex manager [here](/modules/manager/regex/). For template fields, use the triple brace `{{{ }}}` notation to avoid `handlebars` escaping any special characters. ### matchStrings diff --git a/lib/datasource/repology/readme.md b/lib/datasource/repology/readme.md index f2d0da62e1dda9..5985f7813c9a9b 100644 --- a/lib/datasource/repology/readme.md +++ b/lib/datasource/repology/readme.md @@ -20,7 +20,7 @@ A real world example for this specific datasource would be maintaining system pa "matchStrings": [ "#\\s*renovate:\\s*datasource=(?.*?) depName=(?.*?)( versioning=(?.*?))?\\sENV .*?_VERSION=(?.*)\\s" ], - "versioningTemplate": "{{#if versioning}}{{versioning}}{{else}}semver{{/if}}" + "versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}" } ] } diff --git a/lib/manager/regex/readme.md b/lib/manager/regex/readme.md index a3194fde7efc76..7bda2c92cad92c 100644 --- a/lib/manager/regex/readme.md +++ b/lib/manager/regex/readme.md @@ -84,7 +84,7 @@ The above (obviously not a complete `Dockerfile`, but abbreviated for this examp "matchStrings": [ "datasource=(?.*?) depName=(?.*?)( versioning=(?.*?))?\\sENV .*?_VERSION=(?.*)\\s" ], - "versioningTemplate": "{{#if versioning}}{{versioning}}{{else}}semver{{/if}}" + "versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}" }, { "fileMatch": ["^Dockerfile$"], @@ -97,6 +97,6 @@ The above (obviously not a complete `Dockerfile`, but abbreviated for this examp } ``` -In the above the `versioningTemplate` is not actually necessary because Renovate already defaults to `semver` versioning, but it has been included to help illustrate why we call these fields _templates_. They are named this way because they are compiled using `handlebars` and so can be composed from values you collect in named capture groups. +In the above the `versioningTemplate` is not actually necessary because Renovate already defaults to `semver` versioning, but it has been included to help illustrate why we call these fields _templates_. They are named this way because they are compiled using `handlebars` and so can be composed from values you collect in named capture groups. You will usually want to use the tripe brace `{{{ }}}` template (e.v. `{{{versioniong}}}` to be safe because `handlebars` escapes special characters by default with double braces. By adding the comments to the `Dockerfile`, you can see that instead of four separate `regexManagers` being required, there is now only one - and the `Dockerfile` itself is now somewhat better documented too. The syntax we used there is completely arbitrary and you may choose your own instead if you prefer - just be sure to update your `matchStrings` regex.