@varlet/vite-plugins 2.18.0 → 2.18.2-alpha.1698728560863
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +3 -2
- package/package.json +3 -3
- package/src/markdown.ts +4 -2
package/lib/index.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import markdownIt from "markdown-it";
|
|
3
3
|
import hljs from "highlight.js";
|
|
4
4
|
import { kebabCase } from "@varlet/shared";
|
|
5
|
-
import { pinyin } from "pinyin";
|
|
5
|
+
import { pinyin } from "pinyin-pro";
|
|
6
|
+
var includeChinese = (value) => /[\u4e00-\u9fa5]/.test(value);
|
|
6
7
|
function transformHash(hash) {
|
|
7
|
-
return pinyin(hash, {
|
|
8
|
+
return (includeChinese(hash) ? pinyin(hash, { toneType: "num" }) : hash).replaceAll(" ", "");
|
|
8
9
|
}
|
|
9
10
|
function htmlWrapper(html2) {
|
|
10
11
|
const matches = html2.matchAll(/<h3>(.*?)<\/h3>/g);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/vite-plugins",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.2-alpha.1698728560863",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "vite plugins of varlet",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"fs-extra": "^9.0.1",
|
|
26
26
|
"highlight.js": "^10.7.2",
|
|
27
27
|
"markdown-it": "^12.2.3",
|
|
28
|
-
"pinyin": "3.
|
|
29
|
-
"@varlet/shared": "2.18.
|
|
28
|
+
"pinyin-pro": "3.17.0",
|
|
29
|
+
"@varlet/shared": "2.18.2-alpha.1698728560863"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/ejs": "^3.1.1",
|
package/src/markdown.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import markdownIt from 'markdown-it'
|
|
2
2
|
import hljs from 'highlight.js'
|
|
3
3
|
import { kebabCase } from '@varlet/shared'
|
|
4
|
-
import { pinyin } from 'pinyin'
|
|
4
|
+
import { pinyin } from 'pinyin-pro'
|
|
5
5
|
import type { Plugin } from 'vite'
|
|
6
6
|
|
|
7
|
+
const includeChinese = (value: string) => /[\u4e00-\u9fa5]/.test(value)
|
|
8
|
+
|
|
7
9
|
function transformHash(hash: string) {
|
|
8
|
-
return pinyin(hash, {
|
|
10
|
+
return (includeChinese(hash) ? pinyin(hash, { toneType: 'num' }) : hash).replaceAll(' ', '')
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
function htmlWrapper(html: string) {
|