themekit-js 1.1.63 → 1.1.66
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.
|
@@ -4,6 +4,7 @@ import { useData } from '../composables/data'
|
|
|
4
4
|
import Hero from './blocks/Hero.vue';
|
|
5
5
|
import Doc from './blocks/Doc.vue';
|
|
6
6
|
import Notion from './blocks/Notion.vue';
|
|
7
|
+
import HTML from './blocks/HTML.vue';
|
|
7
8
|
import Features from './blocks/Features.vue';
|
|
8
9
|
const { frontmatter } = useData()
|
|
9
10
|
</script>
|
|
@@ -16,6 +17,7 @@ const { frontmatter } = useData()
|
|
|
16
17
|
<Features :block="item" v-else-if="item.block_type =='Features'"></Features>
|
|
17
18
|
<Doc :block="item" v-else-if="item.block_type =='Doc'" ></Doc>
|
|
18
19
|
<Notion :block="item" v-else-if="item.block_type =='Notion'" ></Notion>
|
|
20
|
+
<HTML :block="item" v-else-if="item.block_type =='HTML'" ></HTML>
|
|
19
21
|
|
|
20
22
|
</div>
|
|
21
23
|
<VPHomeContent v-if="frontmatter.markdownStyles !== false">
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { useData } from 'themekit-js'
|
|
4
|
+
import MarkdownIt from 'markdown-it'
|
|
5
|
+
const { base } = useData()
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
block: any
|
|
9
|
+
}>()
|
|
10
|
+
|
|
11
|
+
const blockVarsRegex = /<scrip([\s\S]*?)cript>/g
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
let content:string=decodeURIComponent(props.block.content)
|
|
15
|
+
let match;
|
|
16
|
+
const mt=MarkdownIt({ html: true, linkify: true })
|
|
17
|
+
|
|
18
|
+
const scripts:any=[]
|
|
19
|
+
while ((match = blockVarsRegex.exec(content))) {
|
|
20
|
+
const script=match[0]
|
|
21
|
+
scripts.push(script)
|
|
22
|
+
}
|
|
23
|
+
for(let j=0;j<scripts.length;j++){
|
|
24
|
+
const scriptHTML:String = mt.render("```javascript\n"+scripts[j]+"\n```",{});
|
|
25
|
+
content=content.replace(scripts[j], scriptHTML+ "<textarea style='display:none;' class='jsloader'>"+scripts[j]+"</textarea>");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const styles= computed(() => {
|
|
30
|
+
|
|
31
|
+
let styles:any=[ ];
|
|
32
|
+
if(props.block['background-color']){
|
|
33
|
+
styles.push({ 'background-color':props.block['background-color']})
|
|
34
|
+
}
|
|
35
|
+
if(props.block['background-image']){
|
|
36
|
+
styles.push({ 'background-image':'url('+base.value+props.block['background-image']+")"})
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
return styles
|
|
40
|
+
})
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template >
|
|
44
|
+
|
|
45
|
+
<div class="vp-doc doc" v-if="block!=null " :style="styles" >
|
|
46
|
+
<div class="container" v-html="content"></div>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
</template>
|
|
50
|
+
<script lang="ts">
|
|
51
|
+
|
|
52
|
+
export default {
|
|
53
|
+
|
|
54
|
+
mounted() {
|
|
55
|
+
const jss=document.getElementsByClassName("jsloader")
|
|
56
|
+
for(let i=0;i<jss.length;i++){
|
|
57
|
+
let scriptObj = document.createElement('script')
|
|
58
|
+
const input = jss[i] as HTMLInputElement;
|
|
59
|
+
scriptObj.innerHTML =input.value.split('>')[1].replace('</script','');
|
|
60
|
+
const parent=jss[0].parentElement;
|
|
61
|
+
if(parent!=null)parent.append(scriptObj)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
<style>
|
|
69
|
+
.doc{ background-size: cover;background-position: center; margin: 0 auto;}
|
|
70
|
+
</style>
|
|
71
|
+
<style scoped>
|
|
72
|
+
.vp-doc{ max-width: 100%;}
|
|
73
|
+
|
|
74
|
+
.container {
|
|
75
|
+
margin: auto;
|
|
76
|
+
width: 100%;
|
|
77
|
+
max-width: 1280px;
|
|
78
|
+
padding: 0 24px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@media (min-width: 640px) {
|
|
82
|
+
.container {
|
|
83
|
+
padding: 0 48px;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@media (min-width: 960px) {
|
|
88
|
+
.container {
|
|
89
|
+
width: 100%;
|
|
90
|
+
padding: 0 64px;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.vp-doc :deep(.VPHomeSponsors),
|
|
95
|
+
.vp-doc :deep(.VPTeamPage) {
|
|
96
|
+
margin-left: var(--vp-offset, calc(50% - 50vw));
|
|
97
|
+
margin-right: var(--vp-offset, calc(50% - 50vw));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.vp-doc :deep(.VPHomeSponsors h2) {
|
|
101
|
+
border-top: none;
|
|
102
|
+
letter-spacing: normal;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.vp-doc :deep(.VPHomeSponsors a),
|
|
106
|
+
.vp-doc :deep(.VPTeamPage a){
|
|
107
|
+
text-decoration: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
</style>
|
package/dist/node/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as getDefaultExportFromCjs, q as c, t as clearCache, n as init, b as build, o as serve, v as version, p as createServer } from './serve-
|
|
1
|
+
import { a as getDefaultExportFromCjs, q as c, t as clearCache, n as init, b as build, o as serve, v as version, p as createServer } from './serve-Cb0QzJhW.js';
|
|
2
2
|
import { createLogger } from 'vite';
|
|
3
3
|
import 'path';
|
|
4
4
|
import 'shiki';
|
package/dist/node/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizePath } from 'vite';
|
|
2
2
|
export { loadEnv } from 'vite';
|
|
3
|
-
import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-
|
|
4
|
-
export { S as ScaffoldThemeType, b as build, p as createServer, e as defineConfig, h as defineConfigWithTheme, d as defineLoader, n as init, j as mergeConfig, r as resolveConfig, l as resolvePages, k as resolveSiteData, i as resolveUserConfig, s as scaffold, o as serve } from './serve-
|
|
3
|
+
import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-Cb0QzJhW.js';
|
|
4
|
+
export { S as ScaffoldThemeType, b as build, p as createServer, e as defineConfig, h as defineConfigWithTheme, d as defineLoader, n as init, j as mergeConfig, r as resolveConfig, l as resolvePages, k as resolveSiteData, i as resolveUserConfig, s as scaffold, o as serve } from './serve-Cb0QzJhW.js';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import 'crypto';
|
|
7
7
|
import 'module';
|
|
@@ -37155,8 +37155,9 @@ const imagePlugin = (md, { lazyLoading } = {}, base) => {
|
|
|
37155
37155
|
if (url.substring(0, 1) == "/" && base != null) {
|
|
37156
37156
|
url = base + url.substring(1, url.length);
|
|
37157
37157
|
}
|
|
37158
|
-
token.attrSet("src", decodeURIComponent(url));
|
|
37159
37158
|
}
|
|
37159
|
+
if (url)
|
|
37160
|
+
token.attrSet("src", decodeURIComponent(url));
|
|
37160
37161
|
}
|
|
37161
37162
|
if (lazyLoading) {
|
|
37162
37163
|
token.attrSet("loading", "lazy");
|
|
@@ -38331,7 +38332,7 @@ async function createMarkdownToVueRenderFn(srcDir, options = {}, pages, isBuild
|
|
|
38331
38332
|
if (blockType == null) ; else if (blockType[0] == "Doc" || blockType[0] == "Github") {
|
|
38332
38333
|
blockContent = md.render(block, env);
|
|
38333
38334
|
} else if (blockType[0] == "HTML") {
|
|
38334
|
-
blockContent = block;
|
|
38335
|
+
blockContent = encodeURIComponent(block);
|
|
38335
38336
|
}
|
|
38336
38337
|
const blockItem = Object.assign(
|
|
38337
38338
|
blockVars,
|
|
@@ -46740,11 +46741,12 @@ function escapeHtml(string) {
|
|
|
46740
46741
|
|
|
46741
46742
|
var escape$1 = /*@__PURE__*/getDefaultExportFromCjs(escapeHtml_1);
|
|
46742
46743
|
|
|
46743
|
-
var version = "1.1.
|
|
46744
|
+
var version = "1.1.66";
|
|
46744
46745
|
|
|
46745
46746
|
async function renderPage(render, config, page, result, appChunk, cssChunk, assets, pageToHashMap, metadataScript, additionalHeadTags) {
|
|
46746
46747
|
const routePath = `/${page.replace(/\.md$/, "")}`;
|
|
46747
46748
|
const siteData = resolveSiteDataByRoute(config.site, routePath);
|
|
46749
|
+
console.log("routePath:" + routePath);
|
|
46748
46750
|
const context = await render(routePath);
|
|
46749
46751
|
const { content, teleports } = await config.postRender?.(context) ?? context;
|
|
46750
46752
|
const pageName = sanitizeFileName(page.replace(/\//g, "_"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "themekit-js",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.66",
|
|
4
4
|
"description": "基于VitePress开发的Markdown静态网站生成器",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@8.15.6",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"keywords": [
|
|
50
50
|
"vite",
|
|
51
51
|
"vue",
|
|
52
|
-
"
|
|
52
|
+
"themekit-js"
|
|
53
53
|
],
|
|
54
54
|
"author": "Seedunk",
|
|
55
55
|
"license": "MIT",
|