Skip to content

Commit e07292a

Browse files
committed
Fix markdown CSS, swap color of doc edit btn
1 parent b831714 commit e07292a

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/templates/Document/View.phtml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ $edit_url = Common::relativeUrlToAbsolute('/document/edit?id=' . rawurlencode($o
2828
$delete_url = Common::relativeUrlToAbsolute('/document/delete?id=' . rawurlencode($object_id));
2929
$edit_visible = ($logged_in && ($logged_in->getOptionsBitmask() & User::OPTION_ACL_DOCUMENT_MODIFY));
3030
$delete_visible = ($logged_in && ($logged_in->getOptionsBitmask() & User::OPTION_ACL_DOCUMENT_DELETE));
31+
require_once('./MarkdownBootstrapFix.inc.php');
3132
require('./header.inc.phtml'); ?>
3233
<div class="container mb-3">
3334
<? if ($object) { ?>
@@ -36,11 +37,11 @@ require('./header.inc.phtml'); ?>
3637
<? if ($delete_visible) { ?>
3738
<span class="float-right ml-1"><a class="btn btn-sm btn-danger" href="<?=$delete_url?>" title="Delete">❌</a></span>
3839
<? } if ($edit_visible) { ?>
39-
<span class="float-right ml-1"><a class="btn btn-sm btn-primary" href="<?=$edit_url?>" title="Edit">📝</a></span>
40+
<span class="float-right ml-1"><a class="btn btn-sm btn-secondary" href="<?=$edit_url?>" title="Edit">📝</a></span>
4041
<? } ?>
4142

4243
<h2><a href="<?=$url?>"><?=filter_var($title, FILTER_SANITIZE_FULL_SPECIAL_CHARS)?></a></h2>
43-
<?=$object->getContent(true)?>
44+
<?=\BNETDocs\Templates\MarkdownBootstrapFix($object->getContent(true))?>
4445

4546
<div class="card"><div class="card-body">
4647
<span class="float-right">
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php /* vim: set colorcolumn=: */
2+
namespace BNETDocs\Templates;
3+
4+
/**
5+
* Adds CSS classes to Markdown output
6+
*/
7+
function MarkdownBootstrapFix(string $v)
8+
{
9+
$v = str_replace('<table>', '<table class="table table-hover table-markdown table-striped">', $v);
10+
$v = str_replace('<blockquote>', '<blockquote class="blockquote">', $v);
11+
$v = str_replace('<img ', '<img class="img-fluid" ', $v);
12+
13+
return $v;
14+
}

0 commit comments

Comments
 (0)