@tnotesjs/core 0.0.5 → 0.0.6

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.
@@ -928,7 +928,11 @@ function defineNotesConfig(overrides = {}) {
928
928
  if (/^notes\/\d{4}/.test(pageData.relativePath)) {
929
929
  const fullPath = path2.resolve(rootPath, pageData.relativePath);
930
930
  try {
931
- pageData.frontmatter.rawContent = fs2.readFileSync(fullPath, "utf-8");
931
+ const raw = fs2.readFileSync(fullPath, "utf-8");
932
+ pageData.frontmatter.rawContent = raw.replace(
933
+ /<\/(script)/gi,
934
+ "<\\/$1"
935
+ );
932
936
  } catch {
933
937
  pageData.frontmatter.rawContent = null;
934
938
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tnotesjs/core",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "TNotes 知识库核心框架 —— 基于 VitePress 的笔记管理系统",
5
5
  "type": "module",
6
6
  "bin": {
@@ -123,7 +123,14 @@ export function defineNotesConfig(overrides: UserConfig = {}) {
123
123
  if (/^notes\/\d{4}/.test(pageData.relativePath)) {
124
124
  const fullPath = path.resolve(rootPath, pageData.relativePath)
125
125
  try {
126
- pageData.frontmatter.rawContent = fs.readFileSync(fullPath, 'utf-8')
126
+ const raw = fs.readFileSync(fullPath, 'utf-8')
127
+ // 防止 raw 中的 `</script>` 字面量在被 JSON.stringify 后注入到
128
+ // `<script>…</script>` 块时提前闭合脚本块(导致 Vue SFC 解析报
129
+ // "Invalid end tag")。在源串里把 `</` 拆开即可,复制时仍是原文。
130
+ pageData.frontmatter.rawContent = raw.replace(
131
+ /<\/(script)/gi,
132
+ '<\\/$1',
133
+ )
127
134
  } catch {
128
135
  pageData.frontmatter.rawContent = null
129
136
  }