static-preview.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <!DOCTYPE html>
  2. <html lang="zh-cmn-Hans">
  3. <head>
  4. <meta charset="utf-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
  7. <meta name="theme-color" content="#f1f7fe">
  8. <meta name="apple-mobile-web-app-capable" content="yes">
  9. <meta name="mobile-web-app-capable" content="yes"/>
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  11. <title>Vditor - A markdown editor written in TypeScript.</title>
  12. <meta name="description"
  13. content="B3log 开源社区 markdown 编辑器,使用 TypeScript 编写。支持在线预览、表情插入、at 用户提示、HTML 转换等必要功能。"/>
  14. <meta property="og:description"
  15. content="B3log 开源社区 markdown 编辑器,使用 TypeScript 编写。支持在线预览、表情插入、at 用户提示、HTML 转换等必要功能。"/>
  16. <meta name="twitter:description" property="og:description" itemprop="description"
  17. content="B3log 开源社区 markdown 编辑器,使用 TypeScript 编写。支持在线预览、表情插入、at 用户提示、HTML 转换等必要功能。"/>
  18. <link rel="dns-prefetch" href="//cdn.jsdelivr.net/"/>
  19. <link rel="preconnect" href="https://cdn.jsdelivr.net">
  20. <link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/npm/vditor/dist/images/logo.png"/>
  21. <link rel="apple-touch-icon" href="https://cdn.jsdelivr.net/npm/vditor/dist/images/logo.png">
  22. <link rel="shortcut icon" type="image/x-icon" href="https://cdn.jsdelivr.net/npm/vditor/dist/images/logo.png">
  23. <meta name="copyright" content="B3log"/>
  24. <meta http-equiv="Window-target" content="_top"/>
  25. <meta property="og:locale" content="zh-cmn-Hans"/>
  26. <meta property="og:title" content="Vditor - A markdown editor written in TypeScript."/>
  27. <meta property="og:site_name" content="Blog-vditor"/>
  28. <meta property="og:url" content="https://github.com/b3log/vditor"/>
  29. <meta name="twitter:card" content="summary"/>
  30. <meta name="twitter:domain" content="b3log.org"/>
  31. <meta name="twitter:title" property="og:title" itemprop="b3lig vditor"
  32. content="Vditor - A markdown editor written in TypeScript."/>
  33. <meta name="twitter:site" content="@B3logOS"/>
  34. <meta name="twitter:url" content="https://github.com/b3log/vditor"/>
  35. <meta property="og:image" content="https://cdn.jsdelivr.net/npm/vditor/dist/images/logo.png"/>
  36. <meta name="twitter:image" content="https://cdn.jsdelivr.net/npm/vditor/dist/images/logo.png"/>
  37. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vditor@latest/dist/index.classic.css"/>
  38. <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/method.min.js"></script>
  39. <style>
  40. .preview {
  41. max-width: 90%;
  42. width: 600px;
  43. margin: 0 auto;
  44. }
  45. </style>
  46. </head>
  47. <body>
  48. <h2><a href="https://hacpai.com/article/1549638745630?r=Vanessa" target="_blank">Doc</a></h2>
  49. <h2><a href="static.html">Vditor for you</a></h2>
  50. <h2>Vditor for Preview</h2>
  51. <div id="preview"></div>
  52. <textarea id="markdownText" class="preview" style="display:none;">## Guide
  53. 这是一篇讲解如何正确使用 **Markdown** 的排版示例,学会这个很有必要,能让你的文章有更佳清晰的排版。
  54. > 引用文本:Markdown is a text formatting syntax inspired
  55. ## 语法指导
  56. ### 普通内容
  57. 这段内容展示了在内容里面一些排版格式,比如:
  58. - **加粗** - `**加粗**`
  59. - *倾斜* - `*倾斜*`
  60. - ~~删除线~~ - `~~删除线~~`
  61. - `Code 标记` - `` `Code 标记` ``
  62. - [超级链接](https://hacpai.com) - `[超级链接](https://hacpai.com)`
  63. - [[email protected]](mailto:[email protected]) - `[[email protected]](mailto:[email protected])`
  64. ### 提及用户
  65. @Vanessa 通过 `@User` 可以在内容中提及用户,被提及的用户将会收到系统通知。
  66. > NOTE:
  67. >
  68. > 1. @用户名之后需要有一个空格
  69. > 2. 新手没有艾特的功能权限
  70. ### 表情符号 Emoji
  71. 支持大部分标准的表情符号,可使用输入法直接输入,也可手动输入字符格式。通过输入 `:` 触发自动完成,可在个人设置中[设置常用表情](https://hacpai.com/settings/function)。
  72. #### 一些表情例子
  73. :smile: :laughing: :dizzy_face: :sob: :cold_sweat: :sweat_smile: :cry: :triumph: :heart_eyes: :relieved:
  74. :+1: :-1: :100: :clap: :bell: :gift: :question: :bomb: :heart: :coffee: :cyclone: :bow: :kiss: :pray: :anger:
  75. ### 大标题 - Heading 3
  76. 你可以选择使用 H1 至 H6,使用 ##(N) 打头。建议帖子或回帖中的顶级标题使用 Heading 3,不要使用 1 或 2,因为 1 是系统站点级,2 是帖子标题级。
  77. > NOTE: 别忘了 # 后面需要有空格!
  78. #### Heading 4
  79. ##### Heading 5
  80. ###### Heading 6
  81. ### 图片
  82. ```
  83. ![alt 文本](http://image-path.png)
  84. ![alt 文本](http://image-path.png "图片 Title 值")
  85. ```
  86. 支持复制粘贴直接上传。
  87. ### 代码块
  88. #### 普通
  89. ```
  90. *emphasize* **strong**
  91. _emphasize_ __strong__
  92. var a = 1
  93. ```
  94. #### 语法高亮支持
  95. 如果在 ``` 后面跟随语言名称,可以有语法高亮的效果哦,比如:
  96. ##### 演示 Go 代码高亮
  97. ```go
  98. package main
  99. import "fmt"
  100. func main() {
  101. fmt.Println("Hello, 世界")
  102. }
  103. ```
  104. ##### 演示 Java 高亮
  105. ```java
  106. public class HelloWorld {
  107. public static void main(String[] args) {
  108. System.out.println("Hello World!");
  109. }
  110. }
  111. ```
  112. > Tip: 语言名称支持下面这些: `ruby`, `python`, `js`, `html`, `erb`, `css`, `coffee`, `bash`, `json`, `yml`, `xml` ...
  113. ### 有序、无序、任务列表
  114. #### 无序列表
  115. - Java
  116. - Spring
  117. - IoC
  118. - AOP
  119. - Go
  120. - gofmt
  121. - Wide
  122. - Node.js
  123. - Koa
  124. - Express
  125. #### 有序列表
  126. 1. Node.js
  127. 1.1. Express
  128. 1.2. Koa
  129. 1.3. Sails
  130. 2. Go
  131. 2.1. gofmt
  132. 2.2. Wide
  133. 3. Java
  134. 3.1. Latke
  135. 3.2. IDEA
  136. #### 任务列表
  137. - [x] 发布 Sym
  138. - [X] 发布 Solo
  139. - [ ] 预约牙医
  140. ### 表格
  141. 如果需要展示数据什么的,可以选择使用表格。
  142. | header 1 | header 3 |
  143. | -------- | -------- |
  144. | cell 1 | cell 2 |
  145. | cell 3 | cell 4 |
  146. | cell 5 | cell 6 |
  147. ### 隐藏细节
  148. <details>
  149. <summary>这里是摘要部分。</summary>
  150. 这里是细节部分。
  151. </details>
  152. ### 段落
  153. 空行可以将内容进行分段,便于阅读。(这是第一段)
  154. 使用空行在 Markdown 排版中相当重要。(这是第二段)
  155. ### 数学公式
  156. 多行公式块:
  157. $$
  158. \frac{1}{
  159. \Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{
  160. \frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {
  161. 1+\frac{e^{-6\pi}}
  162. {1+\frac{e^{-8\pi}}{1+\cdots}}
  163. }
  164. }
  165. $$
  166. 行内公式:
  167. 公式 $a^2 + b^2 = \color{red}c^2$ 是行内。
  168. ### 流程图
  169. ```mermaid
  170. graph TB
  171. c1-->a2
  172. subgraph one
  173. a1-->a2
  174. end
  175. subgraph two
  176. b1-->b2
  177. end
  178. subgraph three
  179. c1-->c2
  180. end
  181. ```
  182. ### 时序图
  183. ```mermaid
  184. sequenceDiagram
  185. Alice->>John: Hello John, how are you?
  186. loop Every minute
  187. John-->>Alice: Great!
  188. end
  189. ```
  190. ### 甘特图
  191. ```mermaid
  192. gantt
  193. title A Gantt Diagram
  194. dateFormat YYYY-MM-DD
  195. section Section
  196. A task :a1, 2019-01-01, 30d
  197. Another task :after a1 , 20d
  198. section Another
  199. Task in sec :2019-01-12 , 12d
  200. another task : 24d
  201. ```
  202. ### 图表
  203. ```echarts
  204. {
  205. "title": { "text": "最近 30 天" },
  206. "tooltip": { "trigger": "axis", "axisPointer": { "lineStyle": { "width": 0 } } },
  207. "legend": { "data": ["帖子", "用户", "回帖"] },
  208. "xAxis": [{
  209. "type": "category",
  210. "boundaryGap": false,
  211. "data": ["2019-05-08","2019-05-09","2019-05-10","2019-05-11","2019-05-12","2019-05-13","2019-05-14","2019-05-15","2019-05-16","2019-05-17","2019-05-18","2019-05-19","2019-05-20","2019-05-21","2019-05-22","2019-05-23","2019-05-24","2019-05-25","2019-05-26","2019-05-27","2019-05-28","2019-05-29","2019-05-30","2019-05-31","2019-06-01","2019-06-02","2019-06-03","2019-06-04","2019-06-05","2019-06-06","2019-06-07"],
  212. "axisTick": { "show": false },
  213. "axisLine": { "show": false }
  214. }],
  215. "yAxis": [{ "type": "value", "axisTick": { "show": false }, "axisLine": { "show": false }, "splitLine": { "lineStyle": { "color": "rgba(0, 0, 0, .38)", "type": "dashed" } } }],
  216. "series": [
  217. {
  218. "name": "帖子", "type": "line", "smooth": true, "itemStyle": { "color": "#d23f31" }, "areaStyle": { "normal": {} }, "z": 3,
  219. "data": ["18","14","22","9","7","18","10","12","13","16","6","9","15","15","12","15","8","14","9","10","29","22","14","22","9","10","15","9","9","15","0"]
  220. },
  221. {
  222. "name": "用户", "type": "line", "smooth": true, "itemStyle": { "color": "#f1e05a" }, "areaStyle": { "normal": {} }, "z": 2,
  223. "data": ["31","33","30","23","16","29","23","37","41","29","16","13","39","23","38","136","89","35","22","50","57","47","36","59","14","23","46","44","51","43","0"]
  224. },
  225. {
  226. "name": "回帖", "type": "line", "smooth": true, "itemStyle": { "color": "#4285f4" }, "areaStyle": { "normal": {} }, "z": 1,
  227. "data": ["35","42","73","15","43","58","55","35","46","87","36","15","44","76","130","73","50","20","21","54","48","73","60","89","26","27","70","63","55","37","0"]
  228. }
  229. ]
  230. }
  231. ```
  232. ### 五线谱
  233. ```abc
  234. X: 24
  235. T: Clouds Thicken
  236. C: Paul Rosen
  237. S: Copyright 2005, Paul Rosen
  238. M: 6/8
  239. L: 1/8
  240. Q: 3/8=116
  241. R: Creepy Jig
  242. K: Em
  243. |:"Em"EEE E2G|"C7"_B2A G2F|"Em"EEE E2G|\
  244. "C7"_B2A "B7"=B3|"Em"EEE E2G|
  245. "C7"_B2A G2F|"Em"GFE "D (Bm7)"F2D|\
  246. 1"Em"E3-E3:|2"Em"E3-E2B|:"Em"e2e gfe|
  247. "G"g2ab3|"Em"gfeg2e|"D"fedB2A|"Em"e2e gfe|\
  248. "G"g2ab3|"Em"gfe"D"f2d|"Em"e3-e3:|
  249. ```
  250. ### 多媒体
  251. 支持 v.qq.com,youtube.com,youku.com,coub.com,facebook.com/video,dailymotion.com,.mp4,.m4v,.ogg,.ogv,.webm,.mp3,.wav 链接解析
  252. https://v.qq.com/x/cover/zf2z0xpqcculhcz/y0016tj0qvh.html
  253. ## 快捷键
  254. 我们的编辑器支持很多快捷键,具体请参考 [键盘快捷键](https://hacpai.com/article/1474030007391)(或者按 "`?` ":smirk_cat:)</textarea>
  255. <script>
  256. Vditor.preview(document.getElementById('preview'),
  257. document.getElementById('markdownText').textContent, {
  258. className: 'preview vditor-reset vditor-reset--anchor',
  259. customEmoji: {
  260. 'sd': '💔',
  261. 'j': 'https://unpkg.com/[email protected]/dist/images/emoji/j.png',
  262. },
  263. speech: {
  264. enable: true,
  265. },
  266. anchor: true
  267. })
  268. </script>
  269. </body>
  270. </html>