Skip to content

Commit

Permalink
better function name
Browse files Browse the repository at this point in the history
  • Loading branch information
Mara-Li committed Jan 26, 2024
1 parent c11d65d commit 5596eec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/conversion/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ function createMarkdownLinks(fileName: string, isEmbed: string, altLink: string,
const anchorMatch = fileName.match(/(#.*)/);
let anchor = anchorMatch ? anchorMatch[0] : null;
const encodedURI = encodeURI(markdownName);
anchor = slugifyWithSettings(anchor, settings);
anchor = slugifyAnchor(anchor, settings);
return `${isEmbed}[${altLink}](${encodedURI}${anchor})`;
}


function slugifyWithSettings(anchor: string | null, settings: GitHubPublisherSettings) {
function slugifyAnchor(anchor: string | null, settings: GitHubPublisherSettings) {
if (anchor && settings.conversion.links.slugify !== "disable") {
switch (settings.conversion.links.slugify) {
case "lower":
Expand Down Expand Up @@ -300,7 +300,7 @@ export async function convertToInternalGithub(
let newLink = link.replace(regToReplace, pathInGithubWithAnchor); //strict replacement of link
if (link.match(/\[.*\]\(.*\)/)) {
if (linkedFile.linked.extension === "md" && !linkedFile.linked.name.includes("excalidraw")) {
anchor = slugifyWithSettings(anchor, settings);
anchor = slugifyAnchor(anchor, settings);
pathInGithub = `${pathInGithub.replaceAll(" ", "%20")}.md#${anchor}`;
//probably useless
// pathInGithub = pathInGithub.replace(/(\.md)?(#.*)/, ".md$2");
Expand Down

0 comments on commit 5596eec

Please sign in to comment.