diff --git a/library/Icinga/Web/View/helpers/string.php b/library/Icinga/Web/View/helpers/string.php index bec504750..5e3b06849 100644 --- a/library/Icinga/Web/View/helpers/string.php +++ b/library/Icinga/Web/View/helpers/string.php @@ -14,6 +14,12 @@ $this->addHelperFunction('nl2br', function ($string) { return nl2br(str_replace(array('\r\n', '\r', '\n'), '
', $string), false); }); -$this->addHelperFunction('markdown', function ($content) { - return Markdown::text($content); +$this->addHelperFunction('markdown', function ($content, $containerAttribs = null) { + if (! isset($containerAttribs['class'])) { + $containerAttribs['class'] = 'markdown'; + } else { + $containerAttribs['class'] .= ' markdown'; + } + + return 'propertiesToString($containerAttribs) . '>' . Markdown::text($content) . ''; }); diff --git a/modules/monitoring/application/views/scripts/downtime/show.phtml b/modules/monitoring/application/views/scripts/downtime/show.phtml index dbc5f6711..d23273379 100644 --- a/modules/monitoring/application/views/scripts/downtime/show.phtml +++ b/modules/monitoring/application/views/scripts/downtime/show.phtml @@ -45,7 +45,7 @@ translate('Comment') ?> - nl2br($this->markdown($this->downtime->comment)) ?> + nl2br($this->markdown($this->downtime->comment)) ?> diff --git a/modules/monitoring/application/views/scripts/partials/comment/comment-detail.phtml b/modules/monitoring/application/views/scripts/partials/comment/comment-detail.phtml index 5443ef2b4..e16cba124 100644 --- a/modules/monitoring/application/views/scripts/partials/comment/comment-detail.phtml +++ b/modules/monitoring/application/views/scripts/partials/comment/comment-detail.phtml @@ -65,6 +65,4 @@ } ?> -

id=""> - nl2br($this->markdown($comment->comment)) ?> -

+nl2br($this->markdown($comment->comment, isset($textId) ? ['id' => $textId] : null)) ?> diff --git a/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml b/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml index cda2dce05..9e733f7aa 100644 --- a/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml +++ b/modules/monitoring/application/views/scripts/partials/downtime/downtime-header.phtml @@ -81,7 +81,5 @@ } ?> -

id=""> - nl2br($this->markdown($downtime->comment)) ?> -

+ nl2br($this->markdown($downtime->comment, isset($textId) ? ['id' => $textId] : null)) ?> diff --git a/modules/monitoring/application/views/scripts/partials/event-history.phtml b/modules/monitoring/application/views/scripts/partials/event-history.phtml index 2860a926a..5c34fdc72 100644 --- a/modules/monitoring/application/views/scripts/partials/event-history.phtml +++ b/modules/monitoring/application/views/scripts/partials/event-history.phtml @@ -180,11 +180,9 @@ $rowAction = Url::fromPath('monitoring/event/show'); ) ?> -

icon($icon, $iconTitle); - } ?>nl2br($this->createTicketLinks($this->markdown($msg))) - // TODO(ak): this allows only a[href] in messages, but plugin output allows more - ?>

+ } ?>nl2br($this->createTicketLinks($this->markdown($msg, ['class' => 'overview-plugin-output']))) ?> diff --git a/modules/monitoring/application/views/scripts/show/components/notes.phtml b/modules/monitoring/application/views/scripts/show/components/notes.phtml index 6011d07f7..87907cfb4 100644 --- a/modules/monitoring/application/views/scripts/show/components/notes.phtml +++ b/modules/monitoring/application/views/scripts/show/components/notes.phtml @@ -38,7 +38,7 @@ if (($navigation->isEmpty() || ! $navigation->hasRenderableItems()) && $notes == getRenderer() ?> -
markdown($notes) ?>
+ markdown($notes) ?> \ No newline at end of file diff --git a/modules/monitoring/public/css/tables.less b/modules/monitoring/public/css/tables.less index 56503e771..04d5a71ee 100644 --- a/modules/monitoring/public/css/tables.less +++ b/modules/monitoring/public/css/tables.less @@ -24,12 +24,6 @@ float: right; } -// Comment text in the comment overview -.comment-text { - // Reset margin - margin: 0; -} - // Type information for backends in the monitoring config .config-label-meta { font-size: @font-size-small; @@ -96,7 +90,6 @@ color: @text-color-light; font-family: @font-family-fixed; font-size: @font-size-small; - margin: 0; white-space: pre-wrap; // Long text in table cells overflows the table's width if the table's layout is not fixed. // Thus overflow-wrap will not have any effect. But w/ the following we set a width of any value diff --git a/public/css/icinga/main.less b/public/css/icinga/main.less index a83073eed..42a34cc2b 100644 --- a/public/css/icinga/main.less +++ b/public/css/icinga/main.less @@ -30,6 +30,17 @@ white-space: pre-wrap; } +.markdown { + > * { + margin-left: 0; + margin-right: 0; + } + + > *:last-child { + margin-bottom: 0; + } +} + .pull-right { float: right; }