Skip to content

Commit d4ffcab

Browse files
committed
fix: JD parser image links
1 parent dcdc554 commit d4ffcab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/common/helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,8 +1960,8 @@ function removeTextFormatting (text) {
19601960
// Remove footnotes
19611961
text = _.replace(text, /\[\^.+?\](: .*?$)?/g, ' ')
19621962
text = _.replace(text, /\s{0,2}\[.*?\]: .*?$/g, ' ')
1963-
// Remove images
1964-
text = _.replace(text, /!\[(.*?)\][[(].*?[\])]/g, ' $1 ')
1963+
// Remove images and keep description unless it is default description "image"
1964+
text = _.replace(text, /!(\[((?!image).*?)\]|\[.*?\])[[(].*?[\])]/g, ' $2 ')
19651965
// Remove inline links
19661966
text = _.replace(text, /\[(.*?)\][[(].*?[\])]/g, ' $1 ')
19671967
// Remove blockquotes

0 commit comments

Comments
 (0)