markdown fix

This commit is contained in:
2026-01-09 11:09:27 -05:00
parent 2633d0f962
commit f9d9c775fb
2 changed files with 5 additions and 4 deletions

View File

@@ -49,9 +49,9 @@ function formatDetails($details, $actionType) {
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css">
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/ticket.css">
<script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/toast.js"></script>
<script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/markdown.js"></script>
<script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/dashboard.js"></script>
<script src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/ticket.js"></script>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script>
// Store ticket data in a global variable
window.ticketData = {
@@ -253,10 +253,10 @@ function formatDetails($details, $actionType) {
echo "<span class='comment-user'>" . htmlspecialchars($displayName) . "</span>";
echo "<span class='comment-date'>" . date('M d, Y H:i', strtotime($comment['created_at'])) . "</span>";
echo "</div>";
echo "<div class='comment-text'>";
echo "<div class='comment-text' " . ($comment['markdown_enabled'] ? "data-markdown" : "") . ">";
if ($comment['markdown_enabled']) {
// For markdown comments, use JavaScript to render
echo "<script>document.write(marked.parse(" . json_encode($comment['comment_text']) . "))</script>";
// Markdown will be rendered by JavaScript
echo htmlspecialchars($comment['comment_text']);
} else {
// For non-markdown comments, convert line breaks to <br> and escape HTML
echo nl2br(htmlspecialchars($comment['comment_text']));