mirror of https://github.com/vuejs/vitepress
feat(theme): auto style markdown content in home page (#3561)
BREAKING CHANGES: styles are now applied by default to markdown content when `layout: home` is set in frontmatter. If they conflict with the styles of your custom component, please set `markdownStyles: false` in frontmatter. --------- Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>pull/3581/head
parent
c70b6bf9bf
commit
09030272b4
@ -0,0 +1,52 @@
|
||||
<script setup lang="ts">
|
||||
import { useWindowSize } from '@vueuse/core'
|
||||
|
||||
const { width: vw } = useWindowSize({ includeScrollbar: false })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="vp-doc container"
|
||||
:style="vw ? { '--vp-offset': `calc(50% - ${vw / 2}px)` } : {}"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
margin: auto;
|
||||
width: 100%;
|
||||
max-width: 1280px;
|
||||
padding: 0 24px;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
.container {
|
||||
padding: 0 48px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 960px) {
|
||||
.container {
|
||||
width: 100%;
|
||||
padding: 0 64px;
|
||||
}
|
||||
}
|
||||
|
||||
.vp-doc :deep(.VPHomeSponsors),
|
||||
.vp-doc :deep(.VPTeamPage) {
|
||||
margin-left: var(--vp-offset, calc(50% - 50vw));
|
||||
margin-right: var(--vp-offset, calc(50% - 50vw));
|
||||
}
|
||||
|
||||
.vp-doc :deep(.VPHomeSponsors h2) {
|
||||
border-top: none;
|
||||
letter-spacing: normal;
|
||||
}
|
||||
|
||||
.vp-doc :deep(.VPHomeSponsors a),
|
||||
.vp-doc :deep(.VPTeamPage a){
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue