From e090fd156991bc0bec291c1e9e061dca62833d6c Mon Sep 17 00:00:00 2001 From: Paul Haerle Date: Sat, 1 May 2021 22:04:09 +0200 Subject: [PATCH] fix "copy" button by quoting description fields... (#182) ...in yaml output and escape quotes inside. Without this change, the YAML outputted isn't valid due to ":" characters in the description which end up throwing errors like /etc/prometheus/rules/prometheus.rules: yaml: line 88: mapping values are not allowed in this context. --- rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules.md b/rules.md index de35f5b..262ee19 100644 --- a/rules.md +++ b/rules.md @@ -88,7 +88,7 @@ severity: {{ rule.severity }} annotations: summary: {{ rule.name }} (instance {% raw %}{{ $labels.instance }}{% endraw %}) - description: {{ rule.description }}\n VALUE = {% raw %}{{ $value }}{% endraw %}\n LABELS: {% raw %}{{ $labels }}{% endraw %} + description: "{{ rule.description | replace: '"', '\"' }}\n VALUE = {% raw %}{{ $value }}{% endraw %}\n LABELS: {% raw %}{{ $labels }}{% endraw %}" {% endhighlight %}