diff --git a/src/app.css b/src/app.css index 3d8be5c..8fea2b5 100644 --- a/src/app.css +++ b/src/app.css @@ -79,7 +79,7 @@ @apply hover:bg-primary-100 dark:hover:bg-primary-800; } - /* Heading */ + /* Section headers */ h1.h-leather, h2.h-leather, h3.h-leather, diff --git a/src/lib/components/Preview.svelte b/src/lib/components/Preview.svelte index 44e6c83..01cd98e 100644 --- a/src/lib/components/Preview.svelte +++ b/src/lib/components/Preview.svelte @@ -195,31 +195,12 @@ {#snippet sectionHeading(title: string, depth: number)} - {#if depth === 0} -

- {title} -

- {:else if depth === 1} -

- {title} -

- {:else if depth === 2} -

- {title} -

- {:else if depth === 3} -

- {title} -

- {:else if depth === 4} -
- {title} -
- {:else} -
- {title} -
- {/if} + {@const headingLevel = Math.min(depth + 1, 6)} + {@const className = $pharosInstance.isFloatingTitle(rootId) ? 'discrete' : 'h-leather'} + + + {title} + {/snippet} {#snippet coverImage(rootId: string, index: number, depth: number)} diff --git a/src/lib/parser.ts b/src/lib/parser.ts index 6450ebf..676b6af 100644 --- a/src/lib/parser.ts +++ b/src/lib/parser.ts @@ -283,6 +283,21 @@ export default class Pharos { return block.convert(); } + /** + * Checks if the node with the given ID is a floating title (discrete header). + * @param id The ID of the node to check. + * @returns True if the node is a floating title, false otherwise. + */ + isFloatingTitle(id: string): boolean { + const normalizedId = this.normalizeId(id); + if (!normalizedId || !this.nodes.has(normalizedId)) { + return false; + } + + const context = this.eventToContextMap.get(normalizedId); + return context === 'floating_title'; + } + /** * Updates the `content` field of a Nostr event in-place. * @param dTag The d tag of the event to update. diff --git a/src/routes/[...catchall]/+page.svelte b/src/routes/[...catchall]/+page.svelte new file mode 100644 index 0000000..dd838c9 --- /dev/null +++ b/src/routes/[...catchall]/+page.svelte @@ -0,0 +1,14 @@ + + +
+

404 - Page Not Found

+

The page you are looking for does not exist or has been moved.

+
+ + +
+
diff --git a/src/styles/publications.css b/src/styles/publications.css index 99ca50e..4db6c03 100644 --- a/src/styles/publications.css +++ b/src/styles/publications.css @@ -230,6 +230,7 @@ @apply w-full; } +<<<<<<< HEAD .coverImage { @apply max-h-[230px] overflow-hidden; } @@ -257,5 +258,29 @@ @apply filter grayscale sepia brightness-75 opacity-50 transition duration-500 ease-in-out saturate-200 hue-rotate-20; } } +======= + /* Discrete headers */ + h3.discrete, + h4.discrete, + h5.discrete, + h6.discrete { + @apply text-gray-800 dark:text-gray-300; + } + + h3.discrete { + @apply text-2xl font-bold; + } + + h4.discrete { + @apply text-xl font-bold; + } + + h5.discrete { + @apply text-lg font-semibold; + } + + h6.discrete { + @apply text-base font-semibold; +>>>>>>> 279fb7ce5912d50a1400636fa27aafab315df0b4 } } \ No newline at end of file