Skip to content

Conversation

@alettsy
Copy link
Contributor

@alettsy alettsy commented Oct 30, 2025

Hello, again! 😊

I thought I'd give a go at resolving issue #66 seeing as some people would like that feature (and I think it may be useful for larger READMEs). I believe this also covers issue #46.

I saw that another user created a way to save to a JSON file, but I thought this is a bit unintuitive because the user would have to keep track of an extra file.

Instead, my approach uses a custom data property on the generated README sections data-importer which allows for identifying the individual sections and routing them through an importer. I used the unified and remark packages to process the README content into a usable HAST tree, and from there process them back into usable settings, based on the default configs per feature.

Each feature has an importer.ts module which provides the necessary function to convert that README section back into a section for the editor. The importer router can be found here src/utils/importer/index.ts.

I have tried to keep the importing as clean as possible, but some features required a lot of URL parameter extracting to retrieve the correct settings (e.g., border and stats).

The import button is on the left side of the canvas underneath the "Toggle theme" button.

I have manually tested as much as possible, and I think that everything is working well. If you'd like, I can try to write some thorough unit tests to go along with it.

Please let me know if there are any issues! 😊

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Enhancement
  • Documentation Update

@vercel
Copy link

vercel bot commented Oct 30, 2025

@alettsy is attempting to deploy a commit to the Mauro de Souza's projects Team on Vercel.

A member of the Team first needs to authorize it.

@alettsy
Copy link
Contributor Author

alettsy commented Oct 30, 2025

It looks like jest doesn't like the unified package. I will take a look at how to fix that

@alettsy
Copy link
Contributor Author

alettsy commented Oct 31, 2025

Not sure why the build failed in the ci - it seems to work fine for me:
image

@alettsy
Copy link
Contributor Author

alettsy commented Oct 31, 2025

There we go! 😊

To resolve the testing issues I ended up having to replace jest with vitest. I just couldn't get jest to play nice with the unified package no matter what I did, but vitest seems to be perfectly fine with everything.

Please let me know if there are any issues with the importing functionality, or anything else!

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.

1 participant