Skip to content

Commit

Permalink
🎨 fix #719
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Aug 22, 2020
1 parent 4db8f13 commit 8745ef2
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 70 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@

### v3.4.7 / 2020-08-xx

* [719](https://github.com/Vanessa219/vditor/issues/719) 支持 ==Mark== 标记语法 `引入特性`
* [711](https://github.com/Vanessa219/vditor/issues/711) 调试工具栏图颜色不适配暗黑主题 `改进功能`
* [718](https://github.com/Vanessa219/vditor/issues/718) 脚注太长浮层渲染溢出 `修复缺陷`
* [716](https://github.com/Vanessa219/vditor/issues/716) insertValue 无法插入html文本 `改进功能`
Expand Down Expand Up @@ -124,6 +125,7 @@
* 文档修改
* 3.4.2 `options.hint.at` => "options.hint.extend: IHintExtend[]"
* 3.4.7 删除线快捷键修改为 `⌘-D`
* 3.4.8 添加 `options.preview.markdown.mark` 配置

### v3.3.12 / 2020-07-28

Expand Down
1 change: 1 addition & 0 deletions demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ window.vditor = new Vditor('vditor', {
preview: {
markdown: {
toc: true,
mark: true,
},
},
toolbarConfig: {
Expand Down
5 changes: 5 additions & 0 deletions src/assets/scss/_sv.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
text-decoration: line-through;
}

.mark:not(.vditor-sv__marker) {
background-color: yellow;
color: black;
}

.h1 {
font-size: 1.75em;
line-height: 44px;
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class Vditor extends VditorMethod {
inlineMathDigit: this.vditor.options.preview.math.inlineDigit,
linkBase: this.vditor.options.preview.markdown.linkBase,
listStyle: this.vditor.options.preview.markdown.listStyle,
mark: this.vditor.options.preview.markdown.mark,
paragraphBeginningSpace: this.vditor.options.preview.markdown.paragraphBeginningSpace,
sanitize: this.vditor.options.preview.markdown.sanitize,
toc: this.vditor.options.preview.markdown.toc,
Expand Down
1 change: 1 addition & 0 deletions src/ts/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export abstract class Constants {
footnotes: true,
linkBase: "",
listStyle: false,
mark: false,
paragraphBeginningSpace: false,
sanitize: true,
toc: false,
Expand Down
1 change: 1 addition & 0 deletions src/ts/markdown/setLute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const setLute = (options: ILuteOptions) => {
lute.SetChineseParagraphBeginningSpace(options.paragraphBeginningSpace);
lute.SetRenderListStyle(options.listStyle);
lute.SetLinkBase(options.linkBase);
lute.SetMark(options.mark);
if (options.lazyLoadImage) {
lute.SetImageLazyLoading(options.lazyLoadImage);
}
Expand Down
143 changes: 73 additions & 70 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,109 +100,110 @@ interface ILuteOptions extends IMarkdownConfig {
inlineMathDigit: boolean;
lazyLoadImage?: string;
}
declare class Lute {
public static WalkStop: number;
public static WalkSkipChildren: number;
public static WalkContinue: number;
public static Version: string;
public static Caret: string;

public static New(): Lute;

public static GetHeadingID(node: ILuteNode): string;

private constructor();

public SetJSRenderers(options?: {
renderers: {
HTML2VditorDOM?: ILuteRender,
HTML2VditorIRDOM?: ILuteRender,
HTML2Md?: ILuteRender,
Md2HTML?: ILuteRender,
Md2VditorDOM?: ILuteRender,
Md2VditorIRDOM?: ILuteRender,
Md2VditorSVDOM?: ILuteRender,
},
}): void;
declare class Lute {
public static WalkStop: number;
public static WalkSkipChildren: number;
public static WalkContinue: number;
public static Version: string;
public static Caret: string;

public static New(): Lute;

public static GetHeadingID(node: ILuteNode): string;

private constructor();

public SetJSRenderers(options?: {
renderers: {
HTML2VditorDOM?: ILuteRender,
HTML2VditorIRDOM?: ILuteRender,
HTML2Md?: ILuteRender,
Md2HTML?: ILuteRender,
Md2VditorDOM?: ILuteRender,
Md2VditorIRDOM?: ILuteRender,
Md2VditorSVDOM?: ILuteRender,
},
}): void;

public SetChineseParagraphBeginningSpace(enable: boolean): void;
public SetChineseParagraphBeginningSpace(enable: boolean): void;

public SetRenderListStyle(enable: boolean): void;
public SetRenderListStyle(enable: boolean): void;

public SetLinkBase(url: string): void;
public SetLinkBase(url: string): void;

public SetSanitize(enable: boolean): void;
public SetMark(enable: boolean): void;

public SetHeadingAnchor(enable: boolean): void;
public SetSanitize(enable: boolean): void;

public SetImageLazyLoading(imagePath: string): void;
public SetHeadingAnchor(enable: boolean): void;

public SetInlineMathAllowDigitAfterOpenMarker(enable: boolean): void;
public SetImageLazyLoading(imagePath: string): void;

public SetToC(enable: boolean): void;
public SetInlineMathAllowDigitAfterOpenMarker(enable: boolean): void;

public SetFootnotes(enable: boolean): void;
public SetToC(enable: boolean): void;

public SetAutoSpace(enable: boolean): void;
public SetFootnotes(enable: boolean): void;

public SetChinesePunct(enable: boolean): void;
public SetAutoSpace(enable: boolean): void;

public SetFixTermTypo(enable: boolean): void;
public SetChinesePunct(enable: boolean): void;

public SetEmojiSite(emojiSite: string): void;
public SetFixTermTypo(enable: boolean): void;

public SetVditorCodeBlockPreview(enable: boolean): void;
public SetEmojiSite(emojiSite: string): void;

public PutEmojis(emojis: IObject): void;
public SetVditorCodeBlockPreview(enable: boolean): void;

public GetEmojis(): IObject;
public PutEmojis(emojis: IObject): void;

public FormatMd(markdown: string): string;
public GetEmojis(): IObject;

// debugger md
public RenderEChartsJSON(text: string): string;
// debugger md
public RenderEChartsJSON(text: string): string;

// md 转换为 html
public Md2HTML(markdown: string): string;
// md 转换为 html
public Md2HTML(markdown: string): string;

// 粘贴时将 html 转换为 md
public HTML2Md(html: string): string;
// 粘贴时将 html 转换为 md
public HTML2Md(html: string): string;

// wysiwyg 转换为 html
public VditorDOM2HTML(vhtml: string): string;
// wysiwyg 转换为 html
public VditorDOM2HTML(vhtml: string): string;

// wysiwyg 输入渲染
public SpinVditorDOM(html: string): string;
// wysiwyg 输入渲染
public SpinVditorDOM(html: string): string;

// 粘贴时将 html 转换为 wysiwyg
public HTML2VditorDOM(html: string): string;
// 粘贴时将 html 转换为 wysiwyg
public HTML2VditorDOM(html: string): string;

// 将 wysiwyg 转换为 md
public VditorDOM2Md(html: string): string;
// 将 wysiwyg 转换为 md
public VditorDOM2Md(html: string): string;

// 将 md 转换为 wysiwyg
public Md2VditorDOM(markdown: string): string;
// 将 md 转换为 wysiwyg
public Md2VditorDOM(markdown: string): string;

// ir 输入渲染
public SpinVditorIRDOM(markdown: string): string;
// ir 输入渲染
public SpinVditorIRDOM(markdown: string): string;

// ir 获取 md
public VditorIRDOM2Md(html: string): string;
// ir 获取 md
public VditorIRDOM2Md(html: string): string;

// md 转换为 ir
public Md2VditorIRDOM(text: string): string;
// md 转换为 ir
public Md2VditorIRDOM(text: string): string;

// 获取 HTML
public VditorIRDOM2HTML(html: string): string;
// 获取 HTML
public VditorIRDOM2HTML(html: string): string;

// 粘贴时将 html 转换为 sv
public HTML2VditorIRDOM(html: string): string;
// 粘贴时将 html 转换为 sv
public HTML2VditorIRDOM(html: string): string;

// sv 输入渲染
public SpinVditorSVDOM(text: string): string;
// sv 输入渲染
public SpinVditorSVDOM(text: string): string;

// 粘贴是 md 转换为 sv
public Md2VditorSVDOM(text: string): string;
// 粘贴是 md 转换为 sv
public Md2VditorSVDOM(text: string): string;
}

declare const webkitAudioContext: {
Expand Down Expand Up @@ -347,6 +348,8 @@ interface IMarkdownConfig {
linkBase?: string;
/** 为列表添加标记,以便[自定义列表样式](https://github.com/Vanessa219/vditor/issues/390) 默认值:false */
listStyle?: boolean;
/** 支持 mark 标记 */
mark?: boolean;
}

/** @link https://hacpai.com/article/1549638745630#options-preview */
Expand Down

0 comments on commit 8745ef2

Please sign in to comment.