diff --git a/__tests__/html.test.ts b/__tests__/html.test.ts
new file mode 100644
index 00000000..9468d976
--- /dev/null
+++ b/__tests__/html.test.ts
@@ -0,0 +1,17 @@
+import { htmlHasBrParagraphBreaks, safelyParseFormattedHtml } from '@/utility/html';
+import { parameterize } from '@/utility/string';
+
+describe('HTML', () => {
+ it('safely parses', () => {
+ expect(safelyParseFormattedHtml('
TEXT
')).toBe('TEXT');
+ expect(safelyParseFormattedHtml('TEXT')).toBe('TEXT');
+ });
+ it('detects br-style paragraph breaks', () => {
+ expect(htmlHasBrParagraphBreaks('TEXT
')).toBeTruthy();
+ expect(htmlHasBrParagraphBreaks('TEXT
')).toBeTruthy();
+ expect(htmlHasBrParagraphBreaks('TEXT
')).toBeTruthy();
+ expect(htmlHasBrParagraphBreaks('TEXT')).toBeFalsy();
+ expect(htmlHasBrParagraphBreaks('TEXT
')).toBeFalsy();
+ expect(htmlHasBrParagraphBreaks('TEXT
')).toBeFalsy();
+ });
+});
diff --git a/src/photo/PhotoGridSidebar.tsx b/src/photo/PhotoGridSidebar.tsx
index 0d1f7b2c..b45dbfac 100644
--- a/src/photo/PhotoGridSidebar.tsx
+++ b/src/photo/PhotoGridSidebar.tsx
@@ -16,7 +16,7 @@ import { useAppState } from '@/state/AppState';
import { useMemo } from 'react';
import HiddenTag from '@/tag/HiddenTag';
import { SITE_ABOUT } from '@/site/config';
-import { htmlHasBrParagraphBreaks, safelyParseFormattedHTML } from '@/utility/html';
+import { htmlHasBrParagraphBreaks, safelyParseFormattedHtml } from '@/utility/html';
import { clsx } from 'clsx/lite';
export default function PhotoGridSidebar({
@@ -50,7 +50,7 @@ export default function PhotoGridSidebar({
htmlHasBrParagraphBreaks(SITE_ABOUT) && 'pb-2',
)}
dangerouslySetInnerHTML={{
- __html: safelyParseFormattedHTML(SITE_ABOUT),
+ __html: safelyParseFormattedHtml(SITE_ABOUT),
}}
/>]}
/>}
diff --git a/src/utility/html.ts b/src/utility/html.ts
index 0f3422f7..9f977a44 100644
--- a/src/utility/html.ts
+++ b/src/utility/html.ts
@@ -2,7 +2,7 @@ import sanitizeHtml from 'sanitize-html';
const ALLOWED_FORMATTING_TAGS = ['b', 'strong', 'i', 'em', 'u', 'br'];
-export const safelyParseFormattedHTML = (text: string) =>
+export const safelyParseFormattedHtml = (text: string) =>
sanitizeHtml(text, {
allowedTags: ALLOWED_FORMATTING_TAGS,
});