From 99331191d19770c5731e336bbc290f752b0b2ef5 Mon Sep 17 00:00:00 2001 From: 50 Date: Sat, 4 Dec 2021 16:00:26 +0800 Subject: [PATCH] fix: image cannot be previewed (#738) * fix: image cannot be previewed,issue #737 * fix test * Update src/lib/core/rules.js Co-authored-by: ygj6 <7699524+ygj6@users.noreply.github.com> Co-authored-by: ygj6 <7699524+ygj6@users.noreply.github.com> --- 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..504a9d4b3 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('