Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update markdown-related packages #497

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

Open
Andarist wants to merge 2 commits into main
base: main
Choose a base branch
Loading
from update-unified-pkgs
Open

Conversation

@Andarist
Copy link
Member

@Andarist Andarist commented May 17, 2025

cc @remcohaszing, maybe you'd have a sec to double-check if I'm using the most kosher tools here? 😅

Copy link

changeset-bot bot commented May 17, 2025
edited
Loading

⚠️ No Changeset found

Latest commit: 990d677

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

Copy link

@remcohaszing remcohaszing left a comment

Choose a reason for hiding this comment

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

I added some tips, but really the tools you’re currently using are fine as-is too. :)


export function getChangelogEntry(changelog: string, version: string) {
let ast = unified().use(remarkParse).parse(changelog)asRoot;
let ast = unified().use(remarkParse).parse(changelog);
Copy link

@remcohaszing remcohaszing May 18, 2025

Choose a reason for hiding this comment

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

Should you support GFM and/or frontmatter here? Is so, you should use remark-gfm / remark-frontmatter.

Unless you need options passed into the function, I recommend to define the processor once outside of the function. This way plugins can cache some of the heavy lifting. This isn’t really applicable to your case, but IMO it’s a good practice. If you use GFM/frontmatter, this also allows you to keep the processor in sync with the stringify processor you use below.

const processor = unified()
 .use(remarkParse)
 .use(remarkFrontmatter)
 .use(remarkGfm)
 .use(remarkStringify)
// ...
let ast = processor.parse(changelog)

If you don’t want any of that, the remark abstractions don’t really offer much. You might as well use the slightly lower level mdast-util-from-markdown and mdast-util-to-markdown.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the review! ❤️

remcohaszing reacted with heart emoji
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@remcohaszing remcohaszing remcohaszing approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /