From 5f28c363133afe54ae56d751ee354590725779c9 Mon Sep 17 00:00:00 2001 From: phaer Date: Thu, 14 Jan 2021 12:38:49 +0100 Subject: [PATCH] fix "copy" button by quoting description fields... ...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 6509c39..1b07e9e 100644 --- a/rules.md +++ b/rules.md @@ -85,7 +85,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 %}