Socket
Socket
Sign inDemoInstall

vitepress-plugin-comment-with-giscus

Package Overview
Dependencies
29
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.14 to 1.1.15

2

lib/giscus.d.ts

@@ -13,2 +13,4 @@ import { AvailableLanguage } from '@giscus/vue';

lang?: AvailableLanguage;
locales?: Record<string, string>;
homePageShowComment?: boolean;
};

@@ -15,0 +17,0 @@ /**

20

lib/giscus.js

@@ -22,4 +22,16 @@ import giscus from '@giscus/vue';

repo: 'xxx/xxx',
repoId: ''
repoId: '',
homePageShowComment: false
};
// console.log('locales --> ', props.locales);
// Set the default language
// 设置默认语言
if (props.locales) {
const element = document.querySelector('html');
const lang = element.getAttribute('lang');
// console.log('lang --> ', lang);
if (lang && props.locales[lang]) {
props.lang = props.locales[lang];
}
}
const lightTheme = props.lightTheme || 'light';

@@ -45,5 +57,5 @@ const darkTheme = props.darkTheme || 'transparent_dark';

}
// If it is the homepage, do not add it
// 如果是首页,则不添加
if (!location.pathname || location.pathname === '/') {
// Whether to display comments on the homepage
// 首页是否显示评论
if (!props.homePageShowComment && (!location.pathname || location.pathname === '/')) {
return;

@@ -50,0 +62,0 @@ }

@@ -14,3 +14,5 @@ import giscus, { AvailableLanguage } from '@giscus/vue';

darkTheme?: string,
lang?: AvailableLanguage
lang?: AvailableLanguage,
locales?: Record<string, string>,
homePageShowComment?: boolean
}

@@ -37,4 +39,19 @@

repo: 'xxx/xxx',
repoId: ''
repoId: '',
homePageShowComment: false
};
// console.log('locales --> ', props.locales);
// Set the default language
// 设置默认语言
if (props.locales) {
const element: HTMLElement | Node | null = document.querySelector('html');
const lang = (element as HTMLElement).getAttribute('lang');
// console.log('lang --> ', lang);
if (lang && props.locales[lang]) {
props.lang = props.locales[lang];
}
}
const lightTheme = props.lightTheme || 'light';

@@ -59,5 +76,5 @@ const darkTheme = props.darkTheme || 'transparent_dark';

}
// If it is the homepage, do not add it
// 如果是首页,则不添加
if (!location.pathname || location.pathname === '/') {
// Whether to display comments on the homepage
// 首页是否显示评论
if (!props.homePageShowComment &&(!location.pathname || location.pathname === '/')) {
return;

@@ -64,0 +81,0 @@ }

{
"name": "vitepress-plugin-comment-with-giscus",
"version": "1.1.14",
"version": "1.1.15",
"description": "vitepress comment plugin based on giscus",

@@ -9,3 +9,4 @@ "type": "module",

"scripts": {
"run": "vitepress dev docs"
"run": "vitepress dev docs",
"build": "vitepress build docs"
},

@@ -12,0 +13,0 @@ "files": [

@@ -50,2 +50,10 @@ # vitepress-plugin-comment-with-giscus

lang: 'en', // default: `zh-CN`
// i18n setting (Note: This configuration will override the default language set by lang)
// Configured as an object with key-value pairs inside:
// [your i18n configuration name]: [corresponds to the language pack name in Giscus]
locales: {
'zh-Hans': 'zh-CN',
'en-US': 'en'
},
homePageShowComment: false, // Whether to display the comment area on the homepage, the default is false
lightTheme: 'light', // default: `light`

@@ -91,6 +99,10 @@ darkTheme: 'transparent_dark', // default: `transparent_dark`

<details>
<details open>
<summary>change log</summary>
<ul>
<li>
<p>v1.1.15</p>
<p>new i18n setting</p>
</li>
<li>
<p>v1.1.10</p>

@@ -97,0 +109,0 @@ <p>Now customizable day/night themes</p>

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc