aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
authorwinter2025-02-14 17:56:45 +0000
committerwinter2025-02-14 17:56:58 +0000
commit45ac20c7a4d632bbb23aaba50c2d79ac5ebac465 (patch)
treeeb72692648bdf6c6e78d0334d96342dc79ce728d /templates
parent42e38069e28f84af921b4ea877dc84b4de02c3fe (diff)
implement formatted note contents (html and commonmark)
Diffstat (limited to 'templates')
-rw-r--r--templates/note.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/templates/note.php b/templates/note.php
index db4fbb9..b5b07df 100644
--- a/templates/note.php
+++ b/templates/note.php
@@ -24,9 +24,10 @@ if ($user != null) {
<div class="infoLine">
<a class="authorName"
- href="/@/<?= $note->author->getFullHandle() ?>"><?= htmlspecialchars($note->author->displayName) ?></a>
- <span class="authorHandle">@<?= $note->author->getFullHandle() ?></span>
- <a class="timestamp" href="/@/<?= $note->author->getFullHandle() ?>/note/<?= $note->id ?>">
+ href="/@/<?= htmlspecialchars($note->author->getFullHandle()) ?>"><?= htmlspecialchars($note->author->displayName) ?></a>
+ <span class="authorHandle">@<?= htmlspecialchars($note->author->getFullHandle()) ?></span>
+ <a class="timestamp"
+ href="/@/<?= htmlspecialchars($note->author->getFullHandle()) ?>/note/<?= $note->id ?>">
<?= format_datetime($note->created, $prefs?->get('locale.timezone'))
. (isset($note->modified) && $note->modified != $note->created
? ' (' . format_datetime($note->modified, $prefs?->get('locale.timezone')) . ')'
@@ -49,7 +50,8 @@ if ($user != null) {
<?php if (isset($note->inReplyTo)): ?>
<div class="replyInfo">
<span class="material-symbols reply inlineIcon"></span>
- <a href="/@/<?= $note->inReplyTo->author->getFullHandle() ?>/note/<?= $note->inReplyTo->id ?>">
+ <a
+ href="/@/<?= htmlspecialchars($note->inReplyTo->author->getFullHandle()) ?>/note/<?= $note->inReplyTo->id ?>">
<?= sprintf(__('note.info.replyTo'),
'<b>' . htmlspecialchars($note->inReplyTo->author->displayName)) . '</b>' ?>
</a>
@@ -59,7 +61,7 @@ if ($user != null) {
<span class="material-symbols alternate-email inlineIcon"></span>
<span>
<?= sprintf(__('note.info.mentions'), implode(', ', array_map(
- fn(Actor $m) => '<b><a href="/@/' . $m->getFullHandle() . '">' . $m->displayName . '</a></b>',
+ fn(Actor $m) => '<b><a href="/@/' . htmlspecialchars($m->getFullHandle()) . '">' . htmlspecialchars($m->displayName) . '</a></b>',
$note->mentions
))) ?>
</span>
@@ -71,7 +73,7 @@ if ($user != null) {
<summary><?= htmlspecialchars($note->summary) ?></summary>
<?php endif; ?>
<div class="content">
- <?= $note->getFormattedContent('text/html') ?? htmlspecialchars($note->plainContent) ?>
+ <?= $note->getBestContentAsHtml() ?>
</div>
<?php if (count($note->attachments) > 0): ?>