-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
103 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { defineComponent, PropType } from 'vue'; | ||
import Editor from '../../MdEditor'; | ||
import { Theme } from '../App'; | ||
import mdText from '../data.md'; | ||
|
||
export default defineComponent({ | ||
props: { | ||
theme: String as PropType<Theme>, | ||
previewTheme: String as PropType<string>, | ||
codeCssName: String as PropType<string> | ||
}, | ||
setup(props) { | ||
return () => ( | ||
<div class="doc"> | ||
<div class="container"> | ||
<Editor | ||
theme={props.theme} | ||
previewTheme={props.previewTheme} | ||
codeCssName={props.codeCssName} | ||
modelValue={mdText} | ||
previewOnly | ||
showCodeRowNumber | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## 1. md-editor-v3 | ||
|
||
Markdown 编辑器,基于 react,使用 jsx 和 typescript 语法开发,支持切换主题、prettier 美化文本等。 | ||
|
||
### 1.1 基本演示 | ||
|
||
**加粗**,<u>下划线</u>,_斜体_,~删除线~,上标<sup>26</sup>,下标<sub>[1]</sub>,`inline code`,[超链接](https://imbf.cc) | ||
|
||
> 引用:世界上没有绝对,只有相对 | ||
## 2. 代码演示 | ||
|
||
```js | ||
import { defineComponent, ref } from 'vue'; | ||
import MdEditor from 'md-editor-v3'; | ||
import 'md-editor-v3/lib/style.css'; | ||
|
||
export default defineComponent({ | ||
name: 'MdEditor', | ||
setup() { | ||
const text = ref(''); | ||
return () => ( | ||
<MdEditor modelValue={text.value} onChange={(v: string) => (text.value = v)} /> | ||
); | ||
} | ||
}); | ||
``` | ||
|
||
## 3. 文本演示 | ||
|
||
依照普朗克长度这项单位,目前可观测的宇宙的直径估计值(直径约 930 亿光年,即 8.8 × 10<sup>26</sup> 米)即为 5.4 × 10<sup>61</sup>倍普朗克长度。而可观测宇宙体积则为 8.4 × 10<sup>184</sup>立方普朗克长度(普朗克体积)。 | ||
|
||
## 4. 表格演示 | ||
|
||
| 昵称 | 猿龄(年) | 来自 | | ||
| ---- | ---------- | --------- | | ||
| 之间 | 3 | 中国-重庆 | | ||
|
||
## 5. 占个坑@! |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Plugin } from 'vite'; | ||
|
||
export default (): Plugin => { | ||
return { | ||
name: 'vite-plugin-markdownImport', | ||
enforce: 'pre', | ||
transform(code, id) { | ||
if (/\.md$/.test(id)) { | ||
return { | ||
code: `export default ${JSON.stringify(code)}` | ||
}; | ||
} else { | ||
return null; | ||
} | ||
} | ||
}; | ||
}; |