@starzkg/vuepress-plugin-page-info
Version:
A comment plugin for vuepress
31 lines (30 loc) • 1.08 kB
JavaScript
// TODO: Support author links
import { useAuthor, useLocaleConfig, } from '@starzkg/vuepress-shared/lib/esm/client';
import { defineComponent, h } from 'vue';
import { commentOptions, pageInfoI18n } from '../define';
import { AuthorIcon } from './icons';
export default defineComponent({
name: 'AuthorInfo',
setup() {
const author = useAuthor(commentOptions.author);
const pageInfoLocale = useLocaleConfig(pageInfoI18n);
return () => author.value.length
? h('span', {
class: 'author-info',
...(commentOptions.hint !== false
? {
'ariaLabel': pageInfoLocale.value.author,
'data-balloon-pos': 'down',
}
: {}),
}, [
h(AuthorIcon),
h('span', author.value.join(', ')),
h('span', {
property: 'author',
content: author.value.join(', '),
}),
])
: null;
},
});