Skip to content

Commit

Permalink
docs: landing page code block link and heading
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderl19 committed Jun 24, 2024
1 parent ac320b7 commit 6311297
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 27 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@fontsource-variable/archivo": "5.0.19",
"@sveltejs/adapter-vercel": "4.0.5",
"@sveltejs/kit": "2.5.17",
"@sveltejs/vite-plugin-svelte": "3.1.1",
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/routes/(homepage)/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script lang="ts">
import 'virtual:uno.css';
import '@fontsource-variable/archivo';
import archivoWoff2 from '@fontsource-variable/archivo/files/archivo-latin-wght-normal.woff2?url';
</script>

<svelte:head>
<link rel="preload" as="font" type="font/woff2" href={archivoWoff2} crossorigin="anonymous" />
</svelte:head>

<slot />
37 changes: 37 additions & 0 deletions src/routes/(homepage)/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<script lang="ts">
import { page } from '$app/stores';
import Embed from '$lib/Embed.svelte';
import landingCode from '../landing-code.txt?raw';
const embedUrl = new URL('embed', $page.url);
embedUrl.searchParams.set('code', new URL('demo.txt', $page.url).toString());
$: embedUrlSearchParamsArray = Array.from(embedUrl.searchParams.entries());
</script>

<svelte:head>
<title>Code Block Embed</title>
<meta
name="description"
content="A site that displays raw text files with syntax highliting. Primarily designed to be embeded within presentations, such as with Tome."
/>
</svelte:head>

<div class="m3 border-rd-xl overflow-hidden bg-stone-1">
<div class="border-rd-xl overflow-x-hidden max-h-lg">
<Embed code={landingCode} wrapLines={false} />
</div>
<p class="mx5 my3 font-sans text-sm text-stone-5">
<span>{embedUrl.protocol}//{embedUrl.host}{embedUrl.pathname}?</span
>{#each embedUrlSearchParamsArray as [key, value], i}<span class="text-green-7">{key}</span
>=<span class="text-blue-7">{value}</span
>{#if embedUrlSearchParamsArray.length - 1 !== i}<span>&</span>{/if}{/each}
</p>
</div>
<div class="mx3 my12 font-sans">
<p class="my6 font-archivo font-medium max-w-lg text-balance text-xl">
Display interactive code blocks in your presentations, or wherever you can embed a webpage.
<!-- View this example <a class="text-blue-7 decoration-none hover:underline" href="">Tome</a>. -->
</p>
</div>
26 changes: 0 additions & 26 deletions src/routes/+page.svelte

This file was deleted.

10 changes: 10 additions & 0 deletions src/routes/demo.txt/+server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { RequestHandler } from './$types';
import landingCode from '../landing-code.txt?raw';

export const GET: RequestHandler = () => {
return new Response(landingCode, {
headers: {
'Content-Type': 'text/plain; charset=utf-8'
}
});
};
7 changes: 6 additions & 1 deletion uno.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@ import { defineConfig } from 'unocss';
import presetMini from '@unocss/preset-mini';

export default defineConfig({
presets: [presetMini()]
presets: [presetMini()],
theme: {
fontFamily: {
archivo: 'Archivo Variable'
}
}
});

0 comments on commit 6311297

Please sign in to comment.