Skip to content

How to render markdown in a component? #4849

@Zezombye

Description

@Zezombye

I have a Footnote component which is essentially expanded text:

<template>
    <span class="footnote" @click="isExpanded = !isExpanded" :class="{ 'expanded': isExpanded }">
        <span v-if="!isExpanded">{{ unexpandedText }}</span>
        <span v-else v-html='text'></span>
    </span>
</template>

This makes it so I can write stuff such as Some point <Footnote unexpandedText="(...)" text="(Unnecessary details)/>. However, I would like to render markdown inside the component, so that I can write <Footnote text="**bold**"/>.

This comment doesn't work for me, as it cannot find the imports (which apparently don't work in client side?)

Is there a way that I can make the component render markdown (ideally including the plugins I've added to it)? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions