Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#65, refactor ast for tags/links] #66

Merged
merged 1 commit into from
Nov 22, 2023
Merged

[#65, refactor ast for tags/links] #66

merged 1 commit into from
Nov 22, 2023

Conversation

mohamedsalem401
Copy link
Contributor

No description provided.

Copy link

changeset-bot bot commented Nov 22, 2023

⚠️ No Changeset found

Latest commit: 9fc56e2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rufuspollock
Copy link
Member

[#65][m]: refactor to have all parsing and extraction of info from markdown in one file.

Specifically we parse to an AST once and then pass that AST to extraction functions.

Motivation is KISS and simpler, more readable code plus (minor for now) better performance.

const links = extractWikiLinks(options?.from || "", source, {
permalinks: options?.permalinks,
});
const links = extractWikiLinks(ast, options);

return {
metadata,
links,
};
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a short comment

// we just factor this function out so we can reuse it in tests of extractTagsFromBody etc

}
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 spaces?

[test: string]: (node: any) => WikiLink;
}

export interface WikiLink {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why called WikiLink and not just link

@rufuspollock rufuspollock merged commit b26a7e7 into main Nov 22, 2023
3 checks passed
@mohamedsalem401 mohamedsalem401 deleted the refactor-ast branch November 24, 2023 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants