~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/hud

A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts

0
0
57 lines · 1.3 KB Raw History
<script lang="ts">
	import type { Marks } from './richtext';

	// A run's words in their formatting: code as code, struck through as
	// struck, bold as strong, italic, underlined and highlighted as marked,
	// and a picture's alt text muted in its place. Bold is the type's
	// semibold in a Leaflet document, as Leaflet draws it.
	let { text, marks }: { text: string; marks: Marks } = $props();

	const element = $derived(marks.code ? 'code' : marks.strike ? 's' : marks.bold ? 'strong' : 'span');
</script>

<svelte:element
	this={element}
	class:bold={marks.bold}
	class:italic={marks.italic}
	class:underline={marks.underline}
	class:highlight={marks.highlight}
	class:image-alt={marks.alt}>{text}</svelte:element
>

<style>
	.bold {
		font-weight: bolder;
	}

	:global(.leaflet) .bold {
		font-weight: var(--font-weight-semibold);
	}

	.italic {
		font-style: italic;
	}

	.underline {
		text-decoration: underline;
	}

	.highlight {
		padding: 0 0.1em;
		border-radius: var(--border-radius-xs);
		background: var(--color-background-warning);
	}

	code {
		padding: 0.1em 0.3em;
		border-radius: var(--border-radius-xs);
		background: var(--color-background-secondary);
		font-family: var(--font-mono);
		font-size: 0.875em;
	}

	.image-alt {
		color: var(--color-text-tertiary);
		font-style: italic;
	}
</style>