-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Provide more slots when extending the default theme #1050
Comments
What's the issue you're having? |
Sure enough, I have also considered this issue and I also think it is unlikely to add About the first solution I mentioned above, once you define a global component, you need to use it after the title every time you write an article. As a programmer, you obviously hate this kind of repetitive transaction. But I have to say it works.
The content mentioned in this section mainly refers to the second solution I tried above, which has a serious problem and requires a manual refresh after opening the page to take effect. That solution has been vetoed by me. In replying to you, I thought of another way:
Do you think this solution is feasible? 😄 |
Not exactly, people use it to change navbar title. Like having |
Probably you can write a markdown-it plugin for this to add your component after every |
Register // .vitepress/config.ts
import { defineConfig } from 'vitepress'
export default defineConfig({
markdown: {
config: (md) => {
md.renderer.rules.heading_close = (tokens, idx, options, env, slf) => {
let htmlResult = slf.renderToken(tokens, idx, options, env, slf)
if (tokens[idx].tag === 'h1') htmlResult += `\n<AfterTitle />`
return htmlResult
}
}
}
}) |
awesome, thank you. 😃 👍 |
Thank you again for solving the problem of Looking forward to |
Co-authored-by: Divyansh Singh <[email protected]>
Is your feature request related to a problem? Please describe.
Hi there!
I want to expand the theme to add content in the red box below, but we do not have slots in these two positions, I would like to ask if there is a good way?
Describe the solution you'd like
Is it possible to add
doc-title-after
,doc-footer-before
slots like that.Describe alternatives you've considered
For example, if I wanted to add content after the title, the schemes I tried were as follows:
Use custom components under the heading of each MD document.Expand the custom content in thedoc-before
slot position, then move it when the page loads.Obviously, they are either troublesome or have problems.
Additional context
I'm sorry to disturb you. In addition to completely customizing the theme, do you have a better plan to guide me? I am just like an amateur in front end.
Say thank you in advance.
Validations
The text was updated successfully, but these errors were encountered: