Skip to content

Commit

Permalink
fix: in some condition, .md is append on image
Browse files Browse the repository at this point in the history
fix #39
  • Loading branch information
Mara-Li committed Nov 12, 2022
1 parent 832e7f2 commit 98e6a5e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugin/contents_conversion/convertLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ export function convertWikilinks(
}
fileContent = fileContent.replace(wikiMatch, linkCreator);
} else if (!fileName.startsWith('http')) {

const altMatch = wikiMatch.match(/(\|).*(]])/);
const altCreator = fileName.split('/');

const altLink = creatorAltLink(altMatch, altCreator, fileName.split('.').at(-1), fileName);
const removeEmbed = !isAttachment(fileName.trim()) && conditionConvert.removeEmbed && isEmbedBool;
if (convertWikilink){
linkCreator = `${isEmbed}[${altLink}](${encodeURI(fileName.trim()) + '.md'})`;
const markdownName = !isAttachment(fileName.trim()) ? fileName.trim() + '.md' : fileName.trim();
linkCreator = `${isEmbed}[${altLink}](${encodeURI(markdownName)})`;
}
if (!isAttachment(fileName.trim()) && !convertLinks && !isEmbedBool) {
linkCreator = altLink;
Expand Down

0 comments on commit 98e6a5e

Please sign in to comment.