-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature request] Use comments in markdown to create content slots #594
Comments
I'm sorry but I can't fully understand the feature, would you please describe some details ? How to use the slots, or which way do you want to distribute slots?
Like this? |
It's looks like docz. I think that feature should be implemented with plugin API rather than VuePress. |
@meteorlxy Something like this: <template>
<div class="home-page-layout">
<Content />
<MyComponent>
<Content name="section1" />
</MyComponent>
<AnotherComponent>
<Content name="section2" />
</AnotherComponent>
</div>
</template>
|
Feature request
Hi! Thanks for all the job done in VuePress, loving it so far!
I'd like to suggest a way to provide content slots directly from markdown.
What problem does this feature solve?
Currently, I believe that all the markdown in a file is provided by a single
<Content>
component (except theexcerpt
part). In order to split the content in different sections we can use slotted components as follows:However, this means we need to copy this structure in every translation file we have (
/fr/index.md
,/es/index.md
, etc.).Apart from that, I'm building a VuePress site by fetching content from a headless CMS (Contentful, specifically), and will have "writers" (not "programmers") adding content there for some pages. Writing Vue components in markdown would make this a bit harder, and also would couple the content to VuePress.
What does the proposed API look like?
Adding comments such as
<!-- slot: my section -->
to indicate different sections/slots in markdown. These sections could be provided in different components like<ContentMySection />
or<Content name="my-section" />
.How should this be implemented in your opinion?
Perhaps just like
<!-- more -->
comment is parsed and extracted asthis.$page.excerpt
, other comments could also be extracted. The result can be provided as<Content>
components or asthis.$page.slot.name
properties (this might require convert md=>html manually?)Are you willing to work on this yourself?**
Yes, with some guidance to make it faster and after discussing details.
The text was updated successfully, but these errors were encountered: