vite-plugin-md icon indicating copy to clipboard operation
vite-plugin-md copied to clipboard

Using named slots in markdown files

Open marguerrrite opened this issue 1 year ago • 3 comments

To get component slots to render correctly, this issue references putting a full return between brackets:

I found the solution for this, you need an extra line between them

# Title
Paragraph Text

<MyComponent>

Is it possible to **parse** markdown and pass it to a slot?

</MyComponent>

Is there a trick in getting named slots to work? To do something like the following:

<MyComponent>

    <template #header>
        My title
    </template>
    <template #card>
        My other slot
    </template>

</MyComponent>

As soon as I introduce the #, I get this parsing error (regardless of full returns):

[plugin:vite:vue] Element is missing end tag.

marguerrrite avatar Mar 17 '23 00:03 marguerrrite

MyComponent.vue

<div>
    <header>
        <slot name="header"/>
    </header>
  
    <div class="card">
        <slot name="card" />
    </div>
</div>

Inside the .MD file

<MyComponent>
    <template v-slot:header>My header</template>
    <template v-slot:card>My card</template>
</MyComponent>

Hope this helps @margueriteroth

DjilanoS avatar Mar 23 '23 13:03 DjilanoS

i have same issue

@DjilanoS not works

modelair avatar Jul 14 '23 22:07 modelair

@margueriteroth did u found a solution?

modelair avatar Jul 14 '23 22:07 modelair