Skip to content

Commit

Permalink
fix: regex and date
Browse files Browse the repository at this point in the history
  • Loading branch information
sinanatra committed Apr 23, 2024
1 parent c597c70 commit f78e2e2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/Markdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
let footnoteCounter = 1;
const htmlWithCustomLinks = htmlText.replace(
/<a\s+href="([^"]+)"\s*>([^<]+)<\/a>/g,
/<a\s+href="([^"]+)"[^>]*>([^<]+)<\/a>/g,
(match, href, text) => {
if (href.startsWith('http')) {
return `<a class="external" target="_blank" href="${href}" title="${text}">${text}</a>`;
Expand Down Expand Up @@ -174,7 +174,15 @@
<div class="author">{data.meta.author}</div>
{/if}
{#if data.meta?.date}
<div class="date">{new Date(data.meta.date)?.toLocaleDateString(data.meta.lang)}</div>
<div class="date">
<div class="date">
{new Date(data.meta.date)?.toLocaleDateString(data.meta.lang, {
day: 'numeric',
month: 'long',
year: 'numeric'
})}
</div>
</div>
{/if}
</div>
<div class="markdown">
Expand Down

0 comments on commit f78e2e2

Please sign in to comment.