Fix bug with newlines markdown converter (#1925)
# What this PR does This PR fixes the bug when new lines were ignored for the existing templates ## Which issue(s) this PR fixes ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [ ] Documentation added (or `pr:no public docs` PR label added if not required) - [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required)
This commit is contained in:
parent
56e7ab9112
commit
ae5c4d368f
4 changed files with 28 additions and 23 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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=[
|
||||
|
|
|
|||
|
|
@ -149,17 +149,17 @@ tests = {
|
|||
},
|
||||
"web": {
|
||||
"title": "KubeJobCompletion",
|
||||
"message": """<p><strong>Status</strong>: firing
|
||||
<strong>Labels:</strong>
|
||||
<em>job</em>: kube-state-metrics
|
||||
<em>instance</em>: 10.143.139.7:8443
|
||||
<em>job_name</em>: email-tracking-perform-initialization-1.0.50
|
||||
<em>severity</em>: warning
|
||||
<em>alertname</em>: KubeJobCompletion
|
||||
<em>namespace</em>: default
|
||||
<em>prometheus</em>: monitoring/k8s
|
||||
<strong>Annotations:</strong>
|
||||
<em>message</em>: Job default/email-tracking-perform-initialization-1.0.50 is taking more than one hour to complete.
|
||||
"message": """<p><strong>Status</strong>: firing <br/>
|
||||
<strong>Labels:</strong> <br/>
|
||||
<em>job</em>: kube-state-metrics <br/>
|
||||
<em>instance</em>: 10.143.139.7:8443 <br/>
|
||||
<em>job_name</em>: email-tracking-perform-initialization-1.0.50 <br/>
|
||||
<em>severity</em>: warning <br/>
|
||||
<em>alertname</em>: KubeJobCompletion <br/>
|
||||
<em>namespace</em>: default <br/>
|
||||
<em>prometheus</em>: monitoring/k8s <br/>
|
||||
<strong>Annotations:</strong> <br/>
|
||||
<em>message</em>: Job default/email-tracking-perform-initialization-1.0.50 is taking more than one hour to complete. <br/>
|
||||
<em>runbook_url</em>: <a href="https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-kubejobcompletion" rel="nofollow noopener" target="_blank">here</a></p>""", # noqa
|
||||
"image_url": None,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -170,18 +170,18 @@ tests = {
|
|||
"web": {
|
||||
"title": "KubeJobCompletion",
|
||||
"message": """\
|
||||
<p><strong>Status</strong>: firing
|
||||
<strong>Labels:</strong>
|
||||
<em>job</em>: kube-state-metrics
|
||||
<em>instance</em>: 10.143.139.7:8443
|
||||
<em>job_name</em>: email-tracking-perform-initialization-1.0.50
|
||||
<em>severity</em>: warning
|
||||
<em>alertname</em>: KubeJobCompletion
|
||||
<em>namespace</em>: default
|
||||
<em>prometheus</em>: monitoring/k8s
|
||||
<strong>Annotations:</strong>
|
||||
<em>message</em>: Job default/email-tracking-perform-initialization-1.0.50 is taking more than one hour to complete.
|
||||
<em>runbook_url</em>: <a href="https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-kubejobcompletion" rel="nofollow noopener" target="_blank">here</a></p>""", # noqa
|
||||
<p><strong>Status</strong>: firing <br/>
|
||||
<strong>Labels:</strong> <br/>
|
||||
<em>job</em>: kube-state-metrics <br/>
|
||||
<em>instance</em>: 10.143.139.7:8443 <br/>
|
||||
<em>job_name</em>: email-tracking-perform-initialization-1.0.50 <br/>
|
||||
<em>severity</em>: warning <br/>
|
||||
<em>alertname</em>: KubeJobCompletion <br/>
|
||||
<em>namespace</em>: default <br/>
|
||||
<em>prometheus</em>: monitoring/k8s <br/>
|
||||
<strong>Annotations:</strong> <br/>
|
||||
<em>message</em>: Job default/email-tracking-perform-initialization-1.0.50 is taking more than one hour to complete. <br/>
|
||||
<em>runbook_url</em>: <a href="https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-kubejobcompletion" rel="nofollow noopener" target="_blank">here</a> </p>""", # noqa
|
||||
"image_url": None,
|
||||
},
|
||||
"sms": {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue