method.d.ts 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /// <reference types="./types" />
  2. import * as adapterRender from "./ts/markdown/adapterRender";
  3. declare class Vditor {
  4. /** 点击图片放大 */
  5. static adapterRender: typeof adapterRender;
  6. /** 点击图片放大 */
  7. static previewImage: (oldImgElement: HTMLImageElement, lang?: "en_US" | "fr_FR" | "ja_JP" | "ko_KR" | "ru_RU" | "sv_SE" | "zh_CN" | "zh_TW", theme?: string) => void;
  8. /** 为 element 中的代码块添加复制按钮 */
  9. static codeRender: (element: HTMLElement) => void;
  10. /** 对 graphviz 进行渲染 */
  11. static graphvizRender: (element: HTMLElement, cdn?: string) => void;
  12. /** 为 element 中的代码块进行高亮渲染 */
  13. static highlightRender: (hljsOption?: IHljs, element?: HTMLElement | Document, cdn?: string) => void;
  14. /** 对数学公式进行渲染 */
  15. static mathRender: (element: HTMLElement, options?: {
  16. cdn?: string;
  17. math?: IMath;
  18. }) => void;
  19. /** 流程图/时序图/甘特图渲染 */
  20. static mermaidRender: (element: HTMLElement, cdn: string, theme: string) => void;
  21. /** 支持markdown的思维导图 */
  22. static markmapRender: (element: HTMLElement, cdn: string, theme: string) => void;
  23. /** flowchart.js 渲染 */
  24. static flowchartRender: (element: HTMLElement, cdn?: string) => void;
  25. /** 图表渲染 */
  26. static chartRender: (element: HTMLElement | Document, cdn: string, theme: string) => void;
  27. /** 五线谱渲染 */
  28. static abcRender: (element?: HTMLElement | Document, cdn?: string) => void;
  29. /** 脑图渲染 */
  30. static mindmapRender: (element: HTMLElement | Document, cdn: string, theme: string) => void;
  31. /** plantuml渲染 */
  32. static plantumlRender: (element?: HTMLElement | Document, cdn?: string) => void;
  33. /** 大纲渲染 */
  34. static outlineRender: (contentElement: HTMLElement, targetElement: Element, vditor?: IVditor) => string;
  35. /** 为[特定链接](https://github.com/Vanessa219/vditor/issues/7)分别渲染为视频、音频、嵌入的 iframe */
  36. static mediaRender: (element: HTMLElement) => void;
  37. /** 对选中的文字进行阅读 */
  38. static speechRender: (element: HTMLElement, lang?: "en_US" | "fr_FR" | "ja_JP" | "ko_KR" | "ru_RU" | "sv_SE" | "zh_CN" | "zh_TW") => void;
  39. /** 对图片进行懒加载 */
  40. static lazyLoadImageRender: (element?: HTMLElement | Document) => boolean;
  41. /** Markdown 文本转换为 HTML,该方法需使用[异步编程](https://ld246.com/article/1546828434083?r=Vaness) */
  42. static md2html: (mdText: string, options?: IPreviewOptions) => Promise<string>;
  43. /** 页面 Markdown 文章渲染 */
  44. static preview: (previewElement: HTMLDivElement, markdown: string, options?: IPreviewOptions) => Promise<void>;
  45. /** 设置代码主题 */
  46. static setCodeTheme: (codeTheme: string, cdn?: string) => void;
  47. /** 设置内容主题 */
  48. static setContentTheme: (contentTheme: string, path: string) => void;
  49. }
  50. export default Vditor;