updated image tag handling to support multi-line tags

This commit is contained in:
dylan 2025-12-28 21:14:30 +00:00
parent 79a27ae368
commit 6819d100d3
2 changed files with 10 additions and 6 deletions

View file

@ -133,9 +133,9 @@ export default async function now() {
`$1${latest.image}$2`, `$1${latest.image}$2`,
) )
} else { } else {
// remove img tags if no image available // remove img tags if no image available (handle multi-line tags)
newNow = newNow.replace( newNow = newNow.replace(
new RegExp(`<img[^>]+src=["']${imageId}["'][^>]*>`, 'gi'), new RegExp(`<img[^>]*src=["']${imageId}["'][^>]*>`, 'gis'),
'', '',
) )
// remove markdown image // remove markdown image

View file

@ -3,8 +3,10 @@
<div style="display: flex; flex-direction: column; gap: 0.75rem;"> <div style="display: flex; flex-direction: column; gap: 0.75rem;">
<div style="background: rgba(166, 227, 161, 0.15); padding: 1rem; border: 4px solid #a6e3a1; color:white;"> <div style="background: rgba(166, 227, 161, 0.15); padding: 1rem; border: 4px solid #a6e3a1; color:white;">
<i class="fa-brands fa-lastfm"></i> I listened to this<br> <div style="text-align: left;">
<a href="https://www.last.fm/user/lookathimthere" style="color: #a6e3a1 !important;">lastfm</a> <i class="fa-brands fa-lastfm"></i> I listened to this<br>
<a href="https://www.last.fm/user/lookathimthere" style="color: #a6e3a1 !important;">lastfm</a>
</div>
</div> </div>
<div <div
style="background: rgba(250, 179, 135, 0.15); padding: 1rem; border: 4px solid #fab387; color:white; display: flex; justify-content: space-between; align-items: center;"> style="background: rgba(250, 179, 135, 0.15); padding: 1rem; border: 4px solid #fab387; color:white; display: flex; justify-content: space-between; align-items: center;">
@ -65,8 +67,10 @@
<img src="weblog-image" style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 4px;"> <img src="weblog-image" style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 4px;">
</div> </div>
<div style="background: rgba(137, 220, 235, 0.15); padding: 1rem; border: 4px solid #89dceb; color:white;"> <div style="background: rgba(137, 220, 235, 0.15); padding: 1rem; border: 4px solid #89dceb; color:white;">
<i class="fa-solid fa-code"></i> I pushed some (bad) code<br> <div style="text-align: left;">
<a href="https://source.tube/dylan" style="color: #89dceb !important;">source.tube</a> <i class="fa-solid fa-code"></i> I pushed some (bad) code<br>
<a href="https://source.tube/dylan" style="color: #89dceb !important;">source.tube</a>
</div>
</div> </div>
</div> </div>