Skip to content

Is there any way to render arbitrary markdown in a layout file? #103

Answered by ElMassimo
YuukanOO asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Julien! @YuukanOO

You can use any markdown-in-JS solution to render the markdown, for example, vue-showdown:

<script setup lang="ts">
import { VueShowdown } from 'vue-showdown'
</script>

<template>
  <Topbar />
  <main>
    <VueShowdown :markdown="$page.description"/>
  </main>
</template>

This won't affect the production bundle size if you use it outside islands, zero JS required.

Try it out and let me know how it goes 😃


This is something I've been thinking about adding this out of the box, although I haven't yet run into the need myself.

An îles native version would use the dev server and compile the markdown using XDM, which would apply any remark or rehype plugins that you've con…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@YuukanOO
Comment options

@ElMassimo
Comment options

@YuukanOO
Comment options

@YuukanOO
Comment options

@ElMassimo
Comment options

Answer selected by ElMassimo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants