Layout
Less than 1 minute
Create flexbox, grid and multi-column layouts with directives.
Settings
import { hopeTheme } from "vuepress-theme-hope";
export default hopeTheme({
markdown: {
layout: true,
},
});Syntax
Use a plural directive to open a layout, a singular directive for its items, and @end to close it.
- Flexbox:
@flexsopens a layout, and@flexadds an item. - CSS Grid:
@gridsopens a layout, and@gridadds an item. - Multi-column:
@columnsopens a layout, and@columnadds an item.
Utilities separated by spaces are supported, such as gap-4, items-center, flex-1 and grid-cols-2, and they are converted to inline styles by default.
You can also use @flexs.nav#top gap-4 to add a class and an id to a layout.
Nesting is supported by closing each layout with @end, and you can use @@, @@@ to state the depth explicitly.
For all supported utilities and options, see @mdit/plugin-layout.
Demo
I grow to fill the available space.
I take my natural width.
Demo
@flexs gap-4 items-center
@flex flex-1
I grow to fill the available space.
@flex
I take my natural width.
@endChangelog
9/24/26, 7:31 AM
View All Changelog
fc49f-on