Skip to content

Commit

Permalink
Fix markdown CSS, swap color of doc edit btn
Browse files Browse the repository at this point in the history
  • Loading branch information
carlbennett committed Jun 24, 2021
1 parent b831714 commit e07292a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/templates/Document/View.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ $edit_url = Common::relativeUrlToAbsolute('/document/edit?id=' . rawurlencode($o
$delete_url = Common::relativeUrlToAbsolute('/document/delete?id=' . rawurlencode($object_id));
$edit_visible = ($logged_in && ($logged_in->getOptionsBitmask() & User::OPTION_ACL_DOCUMENT_MODIFY));
$delete_visible = ($logged_in && ($logged_in->getOptionsBitmask() & User::OPTION_ACL_DOCUMENT_DELETE));
require_once('./MarkdownBootstrapFix.inc.php');
require('./header.inc.phtml'); ?>
<div class="container mb-3">
<? if ($object) { ?>
Expand All @@ -36,11 +37,11 @@ require('./header.inc.phtml'); ?>
<? if ($delete_visible) { ?>
<span class="float-right ml-1"><a class="btn btn-sm btn-danger" href="<?=$delete_url?>" title="Delete">❌</a></span>
<? } if ($edit_visible) { ?>
<span class="float-right ml-1"><a class="btn btn-sm btn-primary" href="<?=$edit_url?>" title="Edit">📝</a></span>
<span class="float-right ml-1"><a class="btn btn-sm btn-secondary" href="<?=$edit_url?>" title="Edit">📝</a></span>
<? } ?>

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

<div class="card"><div class="card-body">
<span class="float-right">
Expand Down
14 changes: 14 additions & 0 deletions src/templates/MarkdownBootstrapFix.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php /* vim: set colorcolumn=: */
namespace BNETDocs\Templates;

/**
* Adds CSS classes to Markdown output
*/
function MarkdownBootstrapFix(string $v)
{
$v = str_replace('<table>', '<table class="table table-hover table-markdown table-striped">', $v);
$v = str_replace('<blockquote>', '<blockquote class="blockquote">', $v);
$v = str_replace('<img ', '<img class="img-fluid" ', $v);

return $v;
}

0 comments on commit e07292a

Please sign in to comment.