diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-03 18:23:00 +0300 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-03 18:23:00 +0300 |
| commit | 78461649639dba10f9ade8b1dba9e8f2c69a4144 (patch) | |
| tree | fc89a83ecc5c8500c77ebc359fd7b7b2b42f085b /src | |
| parent | 0df973de7b554008383a23fd4fc2a0b8e1401b37 (diff) | |
Add husky pre-commit
Diffstat (limited to 'src')
| -rw-r--r-- | src/loaders/pleroma.ts | 29 | ||||
| -rw-r--r-- | src/plugins/remark-admonitions.ts | 2 | ||||
| -rw-r--r-- | src/styles/global.css | 1 |
3 files changed, 18 insertions, 14 deletions
diff --git a/src/loaders/pleroma.ts b/src/loaders/pleroma.ts index feb11c8..952e491 100644 --- a/src/loaders/pleroma.ts +++ b/src/loaders/pleroma.ts @@ -1,7 +1,7 @@ import type { Loader } from "astro/loaders"; import { XMLParser } from "fast-xml-parser"; -import TurndownService from "turndown"; import { marked } from "marked"; +import TurndownService from "turndown"; interface PleromaFeedConfig { instanceUrl: string; @@ -199,12 +199,12 @@ function markdownToHtml(markdown: string): string { breaks: true, // Convert line breaks to <br> gfm: true, // GitHub flavored markdown }); - + // Convert markdown to HTML const html = marked.parse(markdown); - + // Return as string (marked.parse can return string or Promise<string>) - return typeof html === 'string' ? html : ''; + return typeof html === "string" ? html : ""; } function extractTitle(content: string): string { @@ -259,7 +259,7 @@ export function pleromaLoader(config: PleromaFeedConfig): Loader { if (response.ok) { break; // Success, exit retry loop } - throw new Error(`HTTP ${response.status}: ${response.statusText}`); + throw new Error(`HTTP ${response.status}: ${response.statusText}`); } catch (error) { lastError = error; logger.warn(`Attempt ${attempt} failed: ${error}`); @@ -312,16 +312,19 @@ export function pleromaLoader(config: PleromaFeedConfig): Loader { const postId = entry.id.split("/").pop() || entry.id; // Extract source URL from the entry - const sourceUrl = entry.link?.find(link => link["@_rel"] === "alternate")?.["@_href"] || entry.id; + const sourceUrl = + entry.link?.find((link) => link["@_rel"] === "alternate")?.["@_href"] || entry.id; // Extract image attachments - const attachments = entry.link?.filter(link => - link["@_rel"] === "enclosure" && - link["@_type"]?.startsWith("image/") - ).map(link => ({ - url: link["@_href"], - type: link["@_type"] - })) || []; + const attachments = + entry.link + ?.filter( + (link) => link["@_rel"] === "enclosure" && link["@_type"]?.startsWith("image/"), + ) + .map((link) => ({ + url: link["@_href"], + type: link["@_type"], + })) || []; // Create note entry store.set({ diff --git a/src/plugins/remark-admonitions.ts b/src/plugins/remark-admonitions.ts index 1f718ca..09bb284 100644 --- a/src/plugins/remark-admonitions.ts +++ b/src/plugins/remark-admonitions.ts @@ -49,7 +49,7 @@ function transformUnhandledDirective( } /** From Astro Starlight: Function that generates an mdast HTML tree ready for conversion to HTML by rehype. */ -// biome-ignore lint/suspicious/noExplicitAny: <explanation> +// biome-ignore lint/suspicious/noExplicitAny: mdast types require any for flexibility function h(el: string, attrs: Properties = {}, children: any[] = []): P { const { properties, tagName } = _h(el, attrs); return { diff --git a/src/styles/global.css b/src/styles/global.css index bf46988..5f5cdb6 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -42,6 +42,7 @@ } @view-transition { + /* biome-ignore lint/correctness/noUnknownProperty: View Transitions API property */ navigation: auto; } |
