Skip to content

Commit

Permalink
more verbose cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
kmlbgn committed Jan 4, 2024
1 parent 4117f9f commit 81cf45f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/plugins/externalLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { IDocuNotionContext, IPlugin } from "./pluginTypes";
import { error, warning } from "../log";

export const standardExternalLinkConversion: IPlugin = {
name: "standard external link conversion",
name: "ExternalLinkPlugin",
linkModifier: {
match: /\[.*\]\(http.*\)/,
convert: (context: IDocuNotionContext, markdownLink: string) => {
const linkRegExp = /\[([^\]]+)?\]\((http.*)\)/;
const match = linkRegExp.exec(markdownLink);
if (match === null) {
error(
`[standardExternalLinkConversion] Could not parse link ${markdownLink}`
`Link parsing: [ExternalLinkPlugin] Could not parse link ${markdownLink}`
);
return markdownLink;
}
Expand All @@ -19,7 +19,7 @@ export const standardExternalLinkConversion: IPlugin = {
if (label === "bookmark") {
const replacement = `[${url}](${url})`;
warning(
`[standardExternalLinkConversion] Found Notion "Bookmark" link. In Notion this would show as an embed. The best docu-notion can do at the moment is replace "Bookmark" with the actual URL: ${replacement}`
`Link parsing: [ExternalLinkPlugin] Found Notion "Bookmark" link. In Notion this would show as an embed. The best docu-notion can do at the moment is replace "Bookmark" with the actual URL: ${replacement}`
);
return replacement;
}
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/internalLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function convertInternalLink(
}

verbose(
`[InternalLinkPlugin] Converting ${markdownLink} to ${hrefFromNotion}`
`Link parsong: [InternalLinkPlugin] Converting ${markdownLink} to ${hrefFromNotion}`
);

const pages = context.pages;
Expand All @@ -74,7 +74,7 @@ function convertInternalLink(
if (!targetPage) {
// About this situation. See https://github.com/sillsdev/docu-notion/issues/9
warning(
`[InternalLinkPlugin] Could not find the target for ${hrefFromNotion}. Note that links to outline sections are not supported > https://github.com/sillsdev/docu-notion/issues/9`
`Link parsing: [InternalLinkPlugin] Could not find the target for ${hrefFromNotion}. Note that links to outline sections are not supported > https://github.com/sillsdev/docu-notion/issues/9`
);
return "**[Problem Internal Link]**";
}
Expand Down Expand Up @@ -108,7 +108,7 @@ function convertLinkHref(
const { fragmentId } = parseLinkId(url);
// Log only if fragmentId is not an empty string
if (fragmentId !== "") {
verbose(`Parsed ${url} and got Fragment ID: ${fragmentId}`);
verbose(`Link parsing: [InternalLinkPlugin] Parsed ${url} and got Fragment ID: ${fragmentId}`);
}
convertedLink += fragmentId;

Expand Down
2 changes: 1 addition & 1 deletion src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ function doLinkFixes(
config.plugins.some(plugin => {
if (!plugin.linkModifier) return false;
if (plugin.linkModifier.match.exec(originalLinkMarkdown) === null) {
verbose(`Link parsing: plugin "${plugin.name}" did not match this url`);
verbose(`Link parsing: ["${plugin.name}"] Did not match this url`);
return false;
}
const newMarkdown = plugin.linkModifier.convert(
Expand Down

0 comments on commit 81cf45f

Please sign in to comment.