Skip to content
Discussion options

You must be logged in to vote

Well, after some more testing I've actually managed to solve the problem myself.

If it helps anyone else, here's my solution:

<script lang="ts" setup>
import { parseMarkdown } from '@nuxtjs/mdc/runtime';

const mdc = ref('# Hello!');
const binding = ref(mdc.value);

const { data: ast } = await useAsyncData(() => parseMarkdown(unref(mdc)));

watch(mdc, async (newValue) => {
  binding.value = newValue;
  ast.value = await parseMarkdown(newValue);
});
</script>

<template>
  <div class="flex h-screen w-full items-center justify-center gap-4">
    <UTextarea v-model="mdc" size="xl" />
    <div class="border-gray border-1 p-4">
      <MDCRenderer v-if="ast" :body="ast.body" :data="ast.data" />

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rutbergphilip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant