-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Is your feature request related to a problem? Please describe.
When using custom containers in Vitepress, they will automatically inherit the title based on the type of the container. You can override this by supplying title immediately after container opening, however, there is no option to get rid of title completely.
Describe the solution you'd like
It would be nice if there was an option to use containers without titles. Perhaps, if the title is set to -
, then the title can be skipped, and a class applied to remove the extended padding from the top (although, the extended padding can probably be moved to a :has()
selector, see below).
Example:
:::tip -
💡 This is a helpful tip.
:::

:has()
CSS changes
.custom-block {
- padding: 16px 16px 8px;
+ padding: 8px 16px;
}
+ .custom-block:has(.custom-block-title) {
+ padding-top: 16px;
+ }
Describe alternatives you've considered
You can create custom containers yourself, like this:
<div class="custom-block tip" style="padding-top: 8px">
💡 This is a helpful tip.
</div>
However, this is not ergonomical, nor is it future-proof (What if those class names change? What if the padding changes?).
Additional context
The use case for this already exists within Vitepress docs:
vitepress/docs/en/guide/what-is-vitepress.md
Lines 5 to 9 in dd29348
<div class="tip custom-block" style="padding-top: 8px"> | |
Just want to try it out? Skip to the [Quickstart](./getting-started). | |
</div> |
Validations
- Follow our Code of Conduct
- Read the docs.
- Read the Contributing Guidelines.
- Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.