<script setup lang="ts">
import type { InlineToken } from "../notes/markdown";

// Emphasis and code only. `[[wiki-links]]` were the one token type that needed a
// router, a store and a resolver behind it; they are gone (note 2897), and so is all
// of that.
defineProps<{ tokens: InlineToken[] }>();
</script>

<!-- Rendered tightly (no whitespace between tokens) so a token's own leading/trailing
     spaces are preserved and no extra spaces are introduced. -->
<template
  ><template v-for="(t, i) in tokens" :key="i"
    ><strong v-if="t.type === 'bold'" class="font-semibold">{{ t.value }}</strong
    ><em v-else-if="t.type === 'italic'">{{ t.value }}</em
    ><code
      v-else-if="t.type === 'code'"
      class="rounded bg-black/5 px-1 py-0.5 font-mono text-[0.85em] dark:bg-white/10"
      >{{ t.value }}</code
    ><template v-else>{{ t.value }}</template></template
  ></template
>
