From faac3bf173d50656db842568ec72d87f0ac46df0 Mon Sep 17 00:00:00 2001 From: 50 Date: Sat, 4 Dec 2021 11:07:51 +0800 Subject: [PATCH 1/3] fix: image cannot be previewed,issue #737 --- src/lib/core/rules.js | 21 ++++++++++++++++++--- src/lib/mixins/markdown.js | 6 +++++- src/mavon-editor.vue | 4 ++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/lib/core/rules.js b/src/lib/core/rules.js index 064756e16..618806b56 100644 --- a/src/lib/core/rules.js +++ b/src/lib/core/rules.js @@ -1,8 +1,10 @@ export const HEADER_FLAG = ' _MD-HEADER_ '; +export const IMAGE_FLAG = ['_MD-HEADER_', true]; +const IMAGE_FLAG_STR = `${IMAGE_FLAG[0]}="${IMAGE_FLAG[1]}"`; -export function headRule(tocHeadRule) { +export function headRule(defaultTocHeadRule) { return function (tokens, index) { - let code = tocHeadRule(tokens, index); + let code = defaultTocHeadRule(tokens, index); var label = tokens[index + 1]; if (label.type === 'inline') { return code.replace(' Date: Sat, 4 Dec 2021 11:17:04 +0800 Subject: [PATCH 2/3] fix test --- src/lib/core/rules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/core/rules.js b/src/lib/core/rules.js index 618806b56..411e85841 100644 --- a/src/lib/core/rules.js +++ b/src/lib/core/rules.js @@ -1,6 +1,6 @@ export const HEADER_FLAG = ' _MD-HEADER_ '; export const IMAGE_FLAG = ['_MD-HEADER_', true]; -const IMAGE_FLAG_STR = `${IMAGE_FLAG[0]}="${IMAGE_FLAG[1]}"`; +const IMAGE_FLAG_STR = `${IMAGE_FLAG[0]}="${IMAGE_FLAG[1]} "`; export function headRule(defaultTocHeadRule) { return function (tokens, index) { From 6ae620efc1b412bfb4db3b9a2e94698eda3456d2 Mon Sep 17 00:00:00 2001 From: 50 Date: Sat, 4 Dec 2021 15:28:05 +0800 Subject: [PATCH 3/3] Update src/lib/core/rules.js Co-authored-by: ygj6 <7699524+ygj6@users.noreply.github.com> --- src/lib/core/rules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/core/rules.js b/src/lib/core/rules.js index 411e85841..504a9d4b3 100644 --- a/src/lib/core/rules.js +++ b/src/lib/core/rules.js @@ -1,6 +1,6 @@ export const HEADER_FLAG = ' _MD-HEADER_ '; export const IMAGE_FLAG = ['_MD-HEADER_', true]; -const IMAGE_FLAG_STR = `${IMAGE_FLAG[0]}="${IMAGE_FLAG[1]} "`; +const IMAGE_FLAG_STR = `${IMAGE_FLAG[0]}="${IMAGE_FLAG[1]}" `; export function headRule(defaultTocHeadRule) { return function (tokens, index) {