Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yinquan committed May 25, 2024
1 parent f548137 commit 015378d
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 35 deletions.
14 changes: 14 additions & 0 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions packages/core/src/entry.plugins.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import highlightCodeBlockInEditableArea from "./plugins/HighlightCodeBlockInEditableAreaPlugin"
import highlightCodeBlocksInEditableArea from "./plugins/HighlightCodeBlocksInEditableAreaPlugin"
import customCodeBlockRenderer from "./plugins/CustomCodeBlockRendererPlugin"
import customLinkAttrs from "./plugins/CustomLinkAttrsPlugin"
import handleImageClick from "./plugins/HandleImageClickPlugin"
Expand All @@ -23,7 +23,7 @@ import defaultViewerTheme from "./plugins/DefaultViewerTheme"
import defaultEditorTheme from "./plugins/DefaultEditorTheme"

export {
highlightCodeBlockInEditableArea,
highlightCodeBlocksInEditableArea,
customCodeBlockRenderer,
customLinkAttrs,
handleImageClick,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { languages } from "@codemirror/language-data"
import type { Plugin } from '../core/types'

class HighlightCodeBlockInEditableAreaPlugin implements Plugin {
class HighlightCodeBlocksInEditableAreaPlugin implements Plugin {
name: string = 'core-plugin-highlight-code-block-in-editable-area'
cmMarkdownConfig: object

Expand All @@ -12,6 +12,6 @@ class HighlightCodeBlockInEditableAreaPlugin implements Plugin {
}
}

export default function HighlightCodeBlockInEditableArea() {
return new HighlightCodeBlockInEditableAreaPlugin()
export default function HighlightCodeBlocksInEditableArea() {
return new HighlightCodeBlocksInEditableAreaPlugin()
}
3 changes: 0 additions & 3 deletions packages/demo/src/docs/zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,6 @@ interface ToolbarItem {
| | fire | Function(src: string, event: string, detail: Any) | 发布事件消息 |
| | beginDebug | Function() | 开始打印事件信息 |
| | endDebug | Function() | 结束打印事件信息 |
| pluginManager <br> 插件管理 | registerPlugin | Function(plugin: Plugin) | 注册插件 |
| | registerPlugins | Function(plugins: Plugin[]) | 注册多个插件 |
| | unregisterPlugin | Function(name: string) | 注销插件 |
| root <br> 根元素(整个组件最外层的容器) | el | HTMLElement \| null | DOM元素 |
| | selector | string | css选择器 |
| | style | {[key: string]: string} | 样式 |
Expand Down
2 changes: 1 addition & 1 deletion packages/presets/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -314,4 +314,4 @@ onMounted(() => {
width: 1360px;
height: 800px;
}
</style>
</style>./presets/classicSetup
4 changes: 2 additions & 2 deletions packages/presets/src/entry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import classicMarkdownSyntax from "./presets/classicMarkdownSyntax"
import classicSetup from "./presets/classicSetup"

export {
classicMarkdownSyntax
classicSetup
}
24 changes: 0 additions & 24 deletions packages/presets/src/presets/classicMarkdownSyntax.ts

This file was deleted.

49 changes: 49 additions & 0 deletions packages/presets/src/presets/classicSetup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import {
markdownItPlugins,
overlayScrollbars,
math,
customCodeBlockRenderer,
defaultEditorTheme,
defaultViewerTheme,
tocSpy,
syncScrollbars,
highlightCodeBlocksInEditableArea
} from '@smooth-markdown/core/plugins'
import { MermaidRenderer, KatexRenderer, CodeMirrorRenderer } from '@smooth-markdown/core/renderers'
import sup from 'markdown-it-sup'
import sub from 'markdown-it-sub'
import ins from 'markdown-it-ins'
import br from 'markdown-it-br'
import mark from 'markdown-it-mark'
import deflist from 'markdown-it-deflist'
import taskLists from 'markdown-it-task-lists'
import footnote from 'markdown-it-footnote'
import mialert from 'markdown-it-alert'

const classicSetup = [
markdownItPlugins([
[ sup ],
[ sub ],
[ ins ],
[ br ],
[ mark ],
[ deflist ],
[ taskLists ],
[ footnote ],
[ mialert ]
]),
customCodeBlockRenderer({
math: [KatexRenderer],
mermaid: [MermaidRenderer],
default: [CodeMirrorRenderer]
}),
overlayScrollbars(),
math(),
defaultEditorTheme(),
defaultViewerTheme(),
tocSpy(),
syncScrollbars(),
highlightCodeBlocksInEditableArea()
]

export default classicSetup

0 comments on commit 015378d

Please sign in to comment.