Skip to content

Commit

Permalink
fix: rename (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
bingryan authored Sep 26, 2023
1 parent 48fbdfd commit 39ccaff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ export const ATTACHMENT_URL_REGEXP = /!\[\[((.*?)\.(\w+))\]\]/g;
export const MARKDOWN_ATTACHMENT_URL_REGEXP = /!\[(.*?)\]\(((.*?)\.(\w+))\)/g;
export const EMBED_URL_REGEXP = /!\[\[(.*?)\]\]/g;

export const GMT_IMAGE_FORMAT = "![]({0})";
export const GFM_IMAGE_FORMAT = "![]({0})";

export interface MarkdownExportPluginSettings {
output: string;
attachment: string;
GTM: boolean;
GFM: boolean;
}

export const DEFAULT_SETTINGS: MarkdownExportPluginSettings = {
output: "output",
attachment: "attachment",
GTM: true,
GFM: true,
};
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ class MarkdownExportSettingTab extends PluginSettingTab {
)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.GTM)
.setValue(this.plugin.settings.GFM)
.onChange(async (value: boolean) => {
this.plugin.settings.GTM = value;
this.plugin.settings.GFM = value;
await this.plugin.saveSettings();
})
);
Expand Down
6 changes: 3 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ATTACHMENT_URL_REGEXP,
MARKDOWN_ATTACHMENT_URL_REGEXP,
EMBED_URL_REGEXP,
GMT_IMAGE_FORMAT,
GFM_IMAGE_FORMAT,
} from "./config";
import MarkdownExportPlugin from "./main";
import markdownToHTML from './renderer';
Expand Down Expand Up @@ -266,10 +266,10 @@ export async function tryCopyMarkdownByRead(
continue;
}

if (plugin.settings.GTM) {
if (plugin.settings.GFM) {
content = content.replace(
rawImageLink,
GMT_IMAGE_FORMAT.format(hashLink)
GFM_IMAGE_FORMAT.format(hashLink)
);
} else {
content = content.replace(urlEncodedImageLink, hashLink);
Expand Down

0 comments on commit 39ccaff

Please sign in to comment.