diff --git a/CHANGELOG.md b/CHANGELOG.md index 9467f84a..5a01802a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fix bug in the "You're Going Oncall" push notification copy by @joeyorlando ([#1922](https://github.com/grafana/oncall/pull/1922)) +- Fix bug with newlines in markdown converter ([#1925](https://github.com/grafana/oncall/pull/1925)) ## v1.2.21 (2023-05-09) diff --git a/engine/common/utils.py b/engine/common/utils.py index 4f69df3f..9477a91a 100644 --- a/engine/common/utils.py +++ b/engine/common/utils.py @@ -160,6 +160,10 @@ def convert_slack_md_to_html(text): def convert_md_to_html(text): + # Markdown expects two or more spaces at the end of a line to indicate a line break. + # Adding two spaces to any line break to support templates that were built without this in mind. + # https://daringfireball.net/projects/markdown/syntax#p + text = text.replace("\n", " \n") text = markdown2.markdown( text, extras=[ diff --git a/engine/config_integrations/alertmanager.py b/engine/config_integrations/alertmanager.py index 560d7311..e180daa8 100644 --- a/engine/config_integrations/alertmanager.py +++ b/engine/config_integrations/alertmanager.py @@ -149,17 +149,17 @@ tests = { }, "web": { "title": "KubeJobCompletion", - "message": """
Status: firing -Labels: -job: kube-state-metrics -instance: 10.143.139.7:8443 -job_name: email-tracking-perform-initialization-1.0.50 -severity: warning -alertname: KubeJobCompletion -namespace: default -prometheus: monitoring/k8s -Annotations: -message: Job default/email-tracking-perform-initialization-1.0.50 is taking more than one hour to complete. + "message": """
Status: firing
+Labels:
+job: kube-state-metrics
+instance: 10.143.139.7:8443
+job_name: email-tracking-perform-initialization-1.0.50
+severity: warning
+alertname: KubeJobCompletion
+namespace: default
+prometheus: monitoring/k8s
+Annotations:
+message: Job default/email-tracking-perform-initialization-1.0.50 is taking more than one hour to complete.
runbook_url: here
Status: firing -Labels: -job: kube-state-metrics -instance: 10.143.139.7:8443 -job_name: email-tracking-perform-initialization-1.0.50 -severity: warning -alertname: KubeJobCompletion -namespace: default -prometheus: monitoring/k8s -Annotations: -message: Job default/email-tracking-perform-initialization-1.0.50 is taking more than one hour to complete. -runbook_url: here
""", # noqa +Status: firing
+Labels:
+job: kube-state-metrics
+instance: 10.143.139.7:8443
+job_name: email-tracking-perform-initialization-1.0.50
+severity: warning
+alertname: KubeJobCompletion
+namespace: default
+prometheus: monitoring/k8s
+Annotations:
+message: Job default/email-tracking-perform-initialization-1.0.50 is taking more than one hour to complete.
+runbook_url: here