Comments (5)
With vite-plugin-md v0.5.0, now you can write route custom block inside markdown file!!
markdown:
# Hello World
<route lang="yaml">
meta:
layout: home
</route>
from vitesse.
You can't just write custom block to markdown file because it will transform into <template>/* here */</template>
,
there is a option in vite-plugin-pages
call extendRoute
, which can add some custom meta using:
// vite.config.js plugin
Pages({
extendRoute: (route) => {
if (route.component.endsWith('pages/test.md')) {
route.meta.layout = 'home'
}
}
})
from vitesse.
@hannoeru Yah I got it, thanks. So is there another way to specify custom layout directly inside of a markdown file? I tried YAML meta head just like how jekyll does, and it doesn't work as expected. Maybe I should check out the markdown plugin source code.
from vitesse.
Would it be a big change for the vite-markdown plugin to strip out the route block?
from vitesse.
I had to slightly modify @hannoeru snippet to get things working, hopefully this helps someone else :
//vite.config.ts
Pages({
extensions: ['vue', 'md'],
extendRoute: (route) => {
if (/.*\/mydirname\/.*\.md/.test(route.component)) {
route.meta = { layout: 'mylayout' }
}
},
}),
from vitesse.
Related Issues (20)
- I18n Lazy loading
- @antfu/eslint-config does not consider this a TS project HOT 1
- When using the ant-design-vue button, the button background-color is overwritten by the reset style. HOT 1
- Eslint and Prettier Conflicts HOT 1
- PrimeVue: Cannot use import statement outside a module HOT 1
- Linting issue: Type '_ActionsTree' is missing (pinia store) HOT 2
- When I use markdown as the page, the code block shows both themes, because is it an example? HOT 3
- tsconfig.json configuration in Vue project
- Composable syntax HOT 1
- [bug ] : can't force my website visitors to get the new version HOT 3
- Font inconsistency between local run and online demo HOT 1
- 能放开对.d.ts文件的格式化不
- tsconfig error HOT 1
- carbon icon integration with VS Code HOT 1
- Consider using `unplugin-vue-router` HOT 1
- Language preferences are not preserved HOT 1
- I can‘t use ref in the vue^3.3.4and vite^4.4.5 HOT 2
- Page `hi` is missing dynamic route parameters
- layout feature doesn't work HOT 3
- Is there a plan to support jsx? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vitesse.