diff --git a/CHANGELOG.md b/CHANGELOG.md index 7505833d..ea0d9c97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,11 +3,10 @@ ### Features -* 调整plot 语法 为 `!! !!` ([12e607e](https://github.com/pengzhanbo/vuepress-theme-plume/commit/12e607e01cfe18d2fe891a4eab424e06881b7678)) -* 移除 externalLink插件,在主题内实现 ([3d7199f](https://github.com/pengzhanbo/vuepress-theme-plume/commit/3d7199fe29f6c85568d41f7409664c424b095dad)) +* 调整 plot 语法 为 `!! !!` ([12e607e](https://github.com/pengzhanbo/vuepress-theme-plume/commit/12e607e01cfe18d2fe891a4eab424e06881b7678)) +* 移除 externalLink插件 ([3d7199f](https://github.com/pengzhanbo/vuepress-theme-plume/commit/3d7199fe29f6c85568d41f7409664c424b095dad)) * 优化 shiki 插件 ([4cdd51a](https://github.com/pengzhanbo/vuepress-theme-plume/commit/4cdd51a2c6bf145be83c43e7e2ffd320e1650596)) * 支持友情链接页分组 ([de404b2](https://github.com/pengzhanbo/vuepress-theme-plume/commit/de404b24db653eda8f706911ed83b21b63bd8050)) -* upgrade to `vuepress rc12` ([021f46e](https://github.com/pengzhanbo/vuepress-theme-plume/commit/021f46ef3f9157c8a1d8f6cac4db3ab56ffd2990)) ### Performance Improvements @@ -15,7 +14,7 @@ * 优化部分正则校验规则 ([5af709a](https://github.com/pengzhanbo/vuepress-theme-plume/commit/5af709a7623f698a1630054ee8ffda8f1544b753)) * **theme:** 优化多语言配置结构 ([e358224](https://github.com/pengzhanbo/vuepress-theme-plume/commit/e3582242172a7438cf0b14a5a7c1861c4b7e50e0)) * **theme:** blog bottom padding ([ca383cd](https://github.com/pengzhanbo/vuepress-theme-plume/commit/ca383cdd7dff1a6888dd18cea31a7d5574e800d5)) -* update vuepress to `rc-11` ([bc38fad](https://github.com/pengzhanbo/vuepress-theme-plume/commit/bc38fad18c3465a778fee976acd9d09c02b740a6)) +* upgrade to `vuepress rc12` ([021f46e](https://github.com/pengzhanbo/vuepress-theme-plume/commit/021f46ef3f9157c8a1d8f6cac4db3ab56ffd2990)) diff --git a/docs/notes/theme/guide/代码/twoslash.md b/docs/notes/theme/guide/代码/twoslash.md index 970cee10..8c95aeda 100644 --- a/docs/notes/theme/guide/代码/twoslash.md +++ b/docs/notes/theme/guide/代码/twoslash.md @@ -15,13 +15,8 @@ permalink: /guide/markdown/experiment/ 并整合在 [@vuepress-plume/plugin-shikiji](https://github.com/pengzhanbo/vuepress-theme-plume/tree/main/plugins/plugin-shikiji) 中。 > [!important] -> 该功能当前仅在以下版本中通过可用性验证,在后续的所有的版本中均不能保证其可用性,请谨慎使用: -> -> - [x] `vuepress@2.0.0-rc.0` -> - [x] `vuepress@2.0.0-rc.2` -> - [x] `vuepress@2.0.0-rc.7` -> - [x] `vuepress@2.0.0-rc.8` -> - [x] `vuepress@2.0.0-rc.9` +> 从 `vuepress@2.0.0-rc.12` 开始,不再需要对 `@vuepress/markdown` 进行额外的 hack 操作, +> 因此,现在你可以安全的使用这项功能了! ### 概述 @@ -74,56 +69,7 @@ const c = 1 ### 开启功能 -> [!warning] -> 启用该功能需要对 `@vuepress/markdown` 包的源码进行修改,此操作具有一定的风险。 -> -> 由于需要通过 `pnpm patch` 对 `@vuepress/markdown` 包进行补丁。因此,你需要使用 -> `pnpm` 作为你的项目的包管理器。 - -#### 步骤一 - -在项目根目录下,通过 `pnpm patch` 命令对 `@vuepress/markdown` 包进行补丁: - -```sh -pnpm patch @vuepress/markdown --edit-dir _tmp/vuepress__markdown -``` - -该命令将会在你的项目根目录下生成一个 `_tmp/vuepress__markdown` 目录,该目录将会包含 `@vuepress/markdown` 包的源码。 - -#### 步骤二 - -修改 `@vuepress/markdown` 包的源码, 打开 `_tmp/vuepress__markdown/dist/index.js` 文件, -找到 `270` 行,其内容如下: - -```ts -const code = options.highlight?.(token.content, language.name, '') || md.utils.escapeHtml(token.content) -``` - -对其进行修改: - -```ts -const code = options.highlight?.(token.content, language.name, '') || md.utils.escapeHtml(token.content) // [!code --] -const code = options.highlight?.(token.content, language.name, info || '') || md.utils.escapeHtml(token.content) // [!code ++] -``` - -你可以直接复制上面的代码内容,然后粘贴到 `_tmp/vuepress__markdown/dist/index.js` 文件中替换 `248` 行。 - -#### 步骤三 - -将源码修改进行 补丁提交,执行下面的命令: - -```sh -pnpm patch-commit '_tmp/vuepress__markdown' -``` - -此命令将会在你的项目根目录下生成一个 `patch` 目录,该目录将会包含 `@vuepress/markdown` 包的补丁, -并提供 `patchedDependencies` 字段注册到你的项目中。 - -之后你就可以选择 删除 `_tmp/vuepress__markdown` 目录了。 - -#### 步骤四 - -在 主题配置中,将 `twoslash` 选项打开。 +在 主题配置中,启用 `twoslash` 选项。 ```ts export default defineUserConfig({