Add support to import a markdown directory#2196
Conversation
c35b436 to
9ddb854
Compare
9ad77b4 to
52c7b68
Compare
|
Nice feature! I am still testing it and will report what I find :) While migrating one DW (DokuWiki) I noticed, that dealing with ACL's from DW in Collectives isn't that straight forward, so I have to rethink the logical organisation/division of the content in several collectives, rather than just importing the whole DW. While doing that I recognized, that until now it's only posible to resolve links to attachments, when the attachments are in the imported markdown directory too, which they only are, if I use the whole DW, as this comes with so I would just point to Proposal: Would be nice to have a variable flag to set the attachments directory Edit: As a workaround I copied the |
|
Additionally I realized somehow the links again are not resolving. In my head you @mejo- already fixed that issue, I am not really sure what happens here 🤷 The issue is, that DW links like |
|
I withdraw the problem beeing absoulute/relative links. Even in the general import with Currently e.g. I actually thought, that we already had I working version, that took care of this problem, as we were talking about the issue in the converter @mejo- ? I have the feeling that this could be a more complicated issue, since in case I would import a subdirectory of the actual DW, the links will always contain roots that are not present in the new collective @mejo- ? |
@janbaum Just a random thought... would it be feasible to import the entire folder structure instead and just remove the non |
|
@janbaum if you want to import everything, you have to give the path to When I tested it, links in the I don't see an easy path to make link and attachments resolution work when importing just a subdirectory of the Dokuwiki to be honest. Copying the media folder is a good hack 😉 |
182d145 to
e3c2300
Compare
|
I added a playwright test to test the import feature. The PR is ready for review from my side. |
|
Just a potential papercut/confusion: |
|
Another thing that would indeed be interesting: importing sub-directories as actual sub-directories. E.g I have my overall
So first I import My current workaround is to import the first directory as usual, but the second one into another temporary collective, to get the contents right and then hope, that moving the contents from the temp. collective to the actual one by the files app works fine. (it doesn't always, I don't know exactly why) Should I open a separate issue for that? |
This should already be possible. You can give |
Do you have an idea what could be done about the links? I'm hesitant to touch links that cannot be resolved to an existing page as we don't know what to do with them. I'd prefer to keep them as is to be honest. |
e3c2300 to
05c19b5
Compare
LinksJust tried to import this file.txt This was converted to: and then imported identically as: The links are not working, cause they are pointing to e.g. the link "Grundlagen": |
Doesn't add the pages to subpage order of parent page and doesn't call notifyPush. Therefore it's a bit less memory greedy. Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
…wFile Further memory saving improvements when processing many files. Signed-off-by: Jonas <jonas@freesources.org>
Further memory saving improvements when processing many files. Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Further memory saving improvements when processing many files. Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
E.g. Dokuwwiki2Markdown creates `name.md` and folder `name` with subpages. In these cases, use `name.md` as index page for the folder `name`. Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
…class Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
d414b89 to
d9de203
Compare
|
@max-nextcloud I did all the changes we discussed. |
| $directory = $input->getArgument('directory'); | ||
| $userId = $input->getOption('user-id'); | ||
| $parentId = (int)$input->getOption('parent-id'); | ||
| $verbose = (bool)$input->getOption('verbose'); |
There was a problem hiding this comment.
Nitpick: $verbose seems redundant here as the Symfony OutputInterface already tracks verbosity.
In the ProgressReporter this could be used either from $output->isVerbose() or using the writeln() option directly like $this->output->writeln('<info>' . $message . '</info>', OutputInterface::VERBOSITY_VERBOSE);
There was a problem hiding this comment.
Ah nice, didn't know that. I'll keep $verbose in IProgressReporter for now, as the idea is to maybe add support for importing via API later on and then we will need a second implementation of ProgressReporter that also has to pass in verbosity.
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
📝 Summary
This PR adds a new occ command
occ collectives:import:markdownto import markdown files and referenced attachments from a given directory path.The import function first imports all markdown files and then tries to fix relative links and references to local attachment files.
So far it's only tested with markdown created by Dokuwiki2Markdown as the aim is to add support for migrating a Dokuwiki instance to Collectives.
The PR contains documentation how to use the occ command.
🏁 Checklist
npm run lint/npm run stylelint/composer run cs:check)