feat: add readme importing #163
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

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-importerwhich allows for identifying the individual sections and routing them through an importer. I used theunifiedandremarkpackages 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.tsmodule which provides the necessary function to convert that README section back into a section for the editor. The importer router can be found heresrc/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)