in anghammarad/src/main/scala/com/gu/anghammarad/messages/Messages.scala [69:99]
def hangoutMessage(notification: Notification): HangoutMessage = {
val messageWithAnghammaradNotice = notification.message ++ anghammaradNotice(notification)
val html = mdRenderer.render(mdParser.parse(messageWithAnghammaradNotice))
// hangouts chat supports a subset of tags that differs from the flexmark-generated HTML
.replace("<strong>", "<b>").replace("</strong>", "</b>")
.replace("<em>", "<i>").replace("</em>", "</i>")
.replace("<p>", "").replace("</p>", "<br>")
val json =
s"""{
| "cards": [
| {
| "sections": [
| {
| "header": ${Json.fromString(notification.subject).noSpaces},
| "widgets": [
| {
| "textParagraph": {
| "text": ${Json.fromString(html).noSpaces}
| }
| }
| ]
| }${buttonJson(notification.actions)}
| ]
| }
| ]
|}
|""".stripMargin
HangoutMessage(json, notification.threadKey)
}