Skip to content

Commit

Permalink
feat: 调整plot 语法 为 !! !!
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo committed May 23, 2024
1 parent 7e1094b commit 12e607e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
18 changes: 9 additions & 9 deletions docs/notes/theme/guide/markdown/进阶.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ github: :[tdesign:logo-github-filled]:
为了满足这种小小的心思,主题提供了一个 **“隐秘”文本** 的有趣小功能。它看起来像这样:

:::demo-wrapper
你知道吗, =|鲁迅|= 曾说过:“ =|我没说过这句话!|= ” 令我醍醐灌顶,深受启发,浑身迸发出无可匹敌的
力量!于是,=|我在床上翻了个身|=
你知道吗, !!鲁迅!! 曾说过:“ !!我没说过这句话!!! ” 令我醍醐灌顶,深受启发,浑身迸发出无可匹敌的
力量!于是,!!我在床上翻了个身!!
:::

读者不能直接阅读到完整的内容,部分的内容被 “遮住”,需要鼠标悬停到内容上,才能看到被遮住的内容。
Expand Down Expand Up @@ -148,7 +148,7 @@ export default defineUserConfig({
```ts
interface PlotOptions {
/**
* 是否启用 `=| |=` markdown (该标记为非标准标记,脱离插件将不生效)
* 是否启用 `!! !!` markdown (该标记为非标准标记,脱离插件将不生效)
* 如果设置为 false, 则表示不启用该标记,只能使用 <Plot /> 组件
* @default true
*/
Expand Down Expand Up @@ -176,26 +176,26 @@ interface PlotOptions {
### 语法

```md
=|需要隐秘的内容|=
!!需要隐秘的内容!!
```

如果不想使用 非标准的 `=||=` 标记语法,你可以将 `plot.tag` 设置为 `false`
如果不想使用 非标准的 `!! !!` 标记语法,你可以将 `plot.tag` 设置为 `false`
然后使用 [`<Plot />`](/guide/features/component/#plot) 组件替代。

### 示例

输入:

```md
你知道吗, =|鲁迅|= 曾说过:“ =|我没说过这句话!|= ” 令我醍醐灌顶,深受启发,浑身迸发出无可匹敌的
力量!于是,=|我在床上翻了个身|=
你知道吗, !!鲁迅!! 曾说过:“ !!我没说过这句话!!! ” 令我醍醐灌顶,深受启发,浑身迸发出无可匹敌的
力量!于是,!!我在床上翻了个身!!
```

输出:

:::demo-wrapper
你知道吗, =|鲁迅|= 曾说过:“ =|我没说过这句话!|= ” 令我醍醐灌顶,深受启发,浑身迸发出无可匹敌的
力量!于是,=|我在床上翻了个身|=
你知道吗, !!鲁迅!! 曾说过:“ !!我没说过这句话!!! ” 令我醍醐灌顶,深受启发,浑身迸发出无可匹敌的
力量!于是,!!我在床上翻了个身!!
:::

## 选项组
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-md-power/src/node/features/plot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type { PluginWithOptions } from 'markdown-it'
import type { RuleInline } from 'markdown-it/lib/parser_inline.mjs'

const [openTag, endTag] = ['=|', '|=']
const [openTag, endTag] = ['!!', '!!']

function createTokenizer(): RuleInline {
return (state, silent) => {
Expand All @@ -18,7 +18,7 @@ function createTokenizer(): RuleInline {
if (silent)
return false

// =||=
// - !!!!
if (max - start < 5)
return false

Expand Down
1 change: 0 additions & 1 deletion plugins/plugin-shikiji/src/client/composables/copy-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export function useCopyCode({
return

const timeoutIdMap = new WeakMap<HTMLElement, ReturnType<typeof setTimeout>>()

const { copy } = useClipboard({ legacy: true })

useEventListener('click', (e) => {
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 12e607e

Please sign in to comment.