@sugarat/theme 0.2.15 → 0.2.16
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/node.js +3 -2
- package/package.json +3 -3
- package/src/utils/node/index.ts +3 -1
package/node.js
CHANGED
|
@@ -36,7 +36,7 @@ __export(node_exports, {
|
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(node_exports);
|
|
38
38
|
|
|
39
|
-
// ../../node_modules/.pnpm/vitepress-plugin-tabs@0.2.0_vitepress@1.0.0-rc.
|
|
39
|
+
// ../../node_modules/.pnpm/vitepress-plugin-tabs@0.2.0_vitepress@1.0.0-rc.36_vue@3.3.4/node_modules/vitepress-plugin-tabs/dist/index.js
|
|
40
40
|
var tabsMarker = "=tabs";
|
|
41
41
|
var tabsMarkerLen = tabsMarker.length;
|
|
42
42
|
var ruleBlockTabs = (state, startLine, endLine, silent) => {
|
|
@@ -295,8 +295,9 @@ function isBase64ImageURL(url) {
|
|
|
295
295
|
const regex = /^data:image\/[a-z]+;base64,/;
|
|
296
296
|
return regex.test(url);
|
|
297
297
|
}
|
|
298
|
+
var imageRegex = /!\[.*?\]\((.*?)\s*(".*?")?\)/;
|
|
298
299
|
function getFirstImagURLFromMD(content, route) {
|
|
299
|
-
const url = content.match(
|
|
300
|
+
const url = content.match(imageRegex)?.[1];
|
|
300
301
|
const isHTTPSource = url && url.startsWith("http");
|
|
301
302
|
if (!url) {
|
|
302
303
|
return "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sugarat/theme",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
|
|
5
5
|
"author": "sugar",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"mermaid": "^10.2.4",
|
|
45
45
|
"vitepress-plugin-mermaid": "2.0.13",
|
|
46
46
|
"vitepress-plugin-pagefind": "0.2.10",
|
|
47
|
-
"vitepress-plugin-rss": "0.2.
|
|
47
|
+
"vitepress-plugin-rss": "0.2.1",
|
|
48
48
|
"vitepress-plugin-tabs": "0.2.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"pagefind": "1.0.3",
|
|
57
57
|
"sass": "^1.56.1",
|
|
58
58
|
"typescript": "^4.8.2",
|
|
59
|
-
"vitepress": "1.0.0-rc.
|
|
59
|
+
"vitepress": "1.0.0-rc.36",
|
|
60
60
|
"vue": "^3.3.4"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
package/src/utils/node/index.ts
CHANGED
|
@@ -126,12 +126,14 @@ function isBase64ImageURL(url: string) {
|
|
|
126
126
|
return regex.test(url)
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
const imageRegex = /!\[.*?\]\((.*?)\s*(".*?")?\)/
|
|
130
|
+
|
|
129
131
|
/**
|
|
130
132
|
* 从文档内容中提取封面
|
|
131
133
|
* @param content 文档内容
|
|
132
134
|
*/
|
|
133
135
|
export function getFirstImagURLFromMD(content: string, route: string) {
|
|
134
|
-
const url = content.match(
|
|
136
|
+
const url = content.match(imageRegex)?.[1]
|
|
135
137
|
const isHTTPSource = url && url.startsWith('http')
|
|
136
138
|
if (!url) {
|
|
137
139
|
return ''
|