Built-in Components
By using vuepress-plugin-components
, you can import and use some components in your Markdown files.
Available components:
- ArtPlayer: A video player powered by ArtPlayer
- Badge: Colorful badge component
- BiliBili: Embedded BiliBili video
- CodePen: Embedded CodePen demo
- FontIcon: Font icon component
- PDF: Embedded PDF viewer
- Share: Sharing current page with social medias
- StackBlitz: Embedded StackBlitz demo
- SiteInfo: Display sites
- VPBanner: A banner component
- VPCard: A card component
- VidStack: Audio/Video player powered by VidStack
- XiGua: Embedded XiGua video
To enable components, you should set plugins.components.components
with an array of components names.
Note
By default, <Badge />
is available to align with @vuepress/theme-default
.
<FontIcon />
is enabled anyway, as it's used by the theme internally to provide Icon feature.
import { hopeTheme } from "vuepress-theme-hope";
export default {
theme: hopeTheme({
plugins: {
components: {
// components you want
components: [
"ArtPlayer",
"Badge",
"BiliBili",
"CodePen",
"PDF",
"Share",
"SiteInfo",
"StackBlitz",
"VPBanner",
"VPCard",
"VidStack",
"XiGua",
],
},
},
}),
};
Utilities
Badge
- tip
- warning
- danger
- important
- info
- note
- <Badge text="tip" type="tip" vertical="middle" />
- <Badge text="warning" type="warning" vertical="middle" />
- <Badge text="danger" type="danger" vertical="middle" />
- <Badge text="important" type="important" vertical="middle" />
- <Badge text="info" type="info" vertical="middle" />
- <Badge text="note" type="note" vertical="middle" />
See Badge
SiteInfo
<SiteInfo name="Mr.Hope's Blog" url="https://mister-hope.com" preview="https://theme-hope.vuejs.press/assets/image/mrhope.jpg" />
<SiteInfo
name="Mr.Hope's Blog"
desc="Where there is light, there is hope"
url="https://mister-hope.com"
logo="https://mister-hope.com/logo.svg"
repo="https://github.com/Mister-Hope/Mister-Hope.github.io"
preview="https://theme-hope.vuejs.press/assets/image/mrhope.jpg"
/>
See SiteInfo
FontIcon
Component which allows you to display font icons.
Home icon:
A big and green share icon:
- Home icon: <FontIcon icon="home" />
- A big and green share icon: <FontIcon icon="share" color="#3eaf7c" size="32" />
See FontIcon
Share
<Share />
<Share services="qq,weibo" />
<Share :services="['qq','weibo']" />
<Share colorful />
See Share
Medias
VidStack
Install
vidstack@next
first.
<VidStack
src="https://files.vidstack.io/sprite-fight/720p.mp4"
poster="https://files.vidstack.io/sprite-fight/poster.webp"
/>
<VidStack
title="Agent 327 Operation Barber Shop"
poster="https://files.vidstack.io/agent-327/poster.png"
:src="[
{
src: 'https://files.vidstack.io/agent-327/720p.mp4',
type: 'video/mp4',
},
{
src: 'https://files.vidstack.io/agent-327/720p.avi',
type: 'video/avi',
},
{
src: 'https://files.vidstack.io/agent-327/720p.ogv',
type: 'video/ogg',
},
]"
:tracks="[
{
src: 'https://files.vidstack.io/agent-327/subs/english.vtt',
label: 'English',
language: 'en-US',
kind: 'subtitles',
default: true,
},
{
src: 'https://files.vidstack.io/agent-327/subs/spanish.vtt',
label: 'Spanish',
language: 'es-ES',
kind: 'subtitles',
},
{
src: 'https://files.vidstack.io/agent-327/subs/french.vtt',
label: 'French',
language: 'fr-FR',
kind: 'subtitles',
},
{
src: 'https://files.vidstack.io/agent-327/subs/german.vtt',
label: 'German',
language: 'ge-GE',
kind: 'subtitles',
},
{
src: 'https://files.vidstack.io/agent-327/subs/italian.vtt',
label: 'Italian',
language: 'it-IT',
kind: 'subtitles',
},
{
src: 'https://files.vidstack.io/agent-327/subs/russian.vtt',
label: 'Russian',
language: 'ru-RU',
kind: 'subtitles',
},
// Chapters
{
src: 'https://files.vidstack.io/agent-327/chapters.vtt',
kind: 'chapters',
language: 'en-US',
default: true,
},
]"
thumbnails="https://files.vidstack.io/agent-327/thumbnails.vtt"
/>
<VidStack
src="https://files.vidstack.io/sprite-fight/hls/stream.m3u8"
:tracks="[
{
src: 'https://files.vidstack.io/agent-327/subs/english.vtt',
label: 'English',
language: 'en-US',
kind: 'subtitles',
default: true,
},
{
src: 'https://files.vidstack.io/agent-327/subs/spanish.vtt',
label: 'Spanish',
language: 'es-ES',
kind: 'subtitles',
},
{
src: 'https://files.vidstack.io/agent-327/subs/french.vtt',
label: 'French',
language: 'fr-FR',
kind: 'subtitles',
},
{
src: 'https://files.vidstack.io/agent-327/subs/german.vtt',
label: 'German',
language: 'ge-GE',
kind: 'subtitles',
},
{
src: 'https://files.vidstack.io/agent-327/subs/italian.vtt',
label: 'Italian',
language: 'it-IT',
kind: 'subtitles',
},
{
src: 'https://files.vidstack.io/agent-327/subs/russian.vtt',
label: 'Russian',
language: 'ru-RU',
kind: 'subtitles',
},
// Chapters
{
src: 'https://files.vidstack.io/agent-327/chapters.vtt',
kind: 'chapters',
language: 'en-US',
default: true,
},
]"
thumbnails="https://files.vidstack.io/agent-327/thumbnails.vtt"
/>
<VidStack
src="//theme-hope-assets.vuejs.press/files/sample.mp3"
title="VidStack Audio Demo"
/>
<VidStack
src="youtube/_cMxraX_5RE"
title="VidStack YouTube Demo"
/>
See VidStack
PDF viewer component.
<PDF url="//theme-hope-assets.vuejs.press/files/sample.pdf" />
<PDF url="//theme-hope-assets.vuejs.press/files/sample.pdf" page="2" no-toolbar />
See PDF
BiliBili
Embed BiliBili videos in Markdown files.
<BiliBili aid="34304064" cid="109293122" ratio="9:16" time="60" page="2" />
See BiliBili
ArtPlayer
Install
artplayer
first.
<ArtPlayer src="https://vp-demo.u2sb.com/video/caminandes_03_llamigos_720p.mp4" />
<ArtPlayer
src="https://vp-demo.u2sb.com/video/caminandes_03_llamigos_720p.mp4"
poster="/poster.svg"
/>
<ArtPlayer
src="https://vp-demo.u2sb.com/video/caminandes_03_llamigos_720p.mp4"
airplay
aspect-ratio
auto-size
auto-orientation
auto-playback
fast-forward
flip
fullscreen-web
lock
loop
is-live
muted
mini-progress-bar
pip
screenshot
subtitle-offset
/>
See ArtPlayer
Code
CodePen
A component which allows you to embed CodePen demo.
<CodePen
user="kowlor"
slug-hash="ZYYQoy"
title="Solar System animation - Pure CSS"
:default-tab="['css','result']"
:theme="$isDarkmode? 'dark': 'light'"
/>
<CodePen
link="https://codepen.io/kowlor/pen/ZYYQoy"
title="Solar System animation - Pure CSS"
:default-tab="['css','result']"
:theme="$isDarkmode? 'dark': 'light'"
/>
<CodePen
link="https://codepen.io/kowlor/pen/ZYYQoy"
title="Envelope w/ Hearts"
status="clicktorun"
:default-tab="['css','result']"
:theme="$isDarkmode? 'dark': 'light'"
/>
See CodePen
StackBlitz
Embed StackBlitz demo in Markdown files.
<StackBlitz id="vuepress-theme-hope" />
<StackBlitz id="vuepress-theme-hope" hideExplorer hideNavigation hideDevtools />
See StackBlitz