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

nested readme file uploads not working #25

Closed
bir87 opened this issue Sep 10, 2020 · 14 comments
Closed

nested readme file uploads not working #25

bir87 opened this issue Sep 10, 2020 · 14 comments

Comments

@bir87
Copy link

bir87 commented Sep 10, 2020

markdown2confluence --space 'MyTeamSpace' --parent 'API Docs' markdown-files

I am guessing this should upload all the nested md files present in the dir "markdown-files"? Am i correct.

@justmiles
Copy link
Owner

You are correct. Nested markdown files will be upload under the parent page "API Docs" in the "MyTeamSpace" space.

Unfortunately, nested files with the same name aren't considered different files to Confluence. We're determining the remote page name by matching only the space and filename. So two files named readme.md in different directories are updating the same page in Confluence.

Solving for #14 also requires persisting the file and remote ID locally and having that mapping would subsequently fix this problem too.

Up to this point I've just had unique names for my docs. I realize that's not a real solution, though. I'll probably take a stab at #14 before this one, but happy to accept PRs.

@bir87
Copy link
Author

bir87 commented Sep 13, 2020

Does markdown2confluence upload all these files under 1 parent or it will create the same tree strucutre under that parent in confluence.
Assuming, i have a parent named "test" in confluence will it consist the same tree str as below?

test
├── readme02.md
├── test-01
│   ├── readme1.md
│   └── test-02
│   └── readme-03.md
└── test.md

@justmiles
Copy link
Owner

justmiles commented Sep 13, 2020 via email

@justmiles
Copy link
Owner

For directories it will create a single page with links to the child pages. It might be a good idea to earmark readme.md or index.md files as the content for those base directory pages.

@elijahgagne
Copy link

I like using README.md for this purpose because that's what a lot of Git providers (e.g. GitHub, GitLab, Bitbucket) will display for the content of a folder. A while back I opened up #17. Back in May, in a fork, I implemented the feature to work for my purposes at beb13e3.

I question if this is good enough for a pull request or perhaps a starting point for someone else to improve. If you have any suggestions, I'd be happy to work on it a little and submit a PR.

@justmiles
Copy link
Owner

Hey that's great. If it's worked for you I'm sure it'll work for others. I need to write some unit tests so that people feel more comfortable about submitting PRs but this project hasn't been a high priority. In any case submit a PR! I'm sure others will benefit from it.

@bir87
Copy link
Author

bir87 commented Sep 15, 2020

i am not able to replciate this tree structure below in confluence.
test
├── document.md
├── test-01
│ ├── doc.md
│ └── test-02
│ └── doc-03.md
└── test.md

My output is : everything gets put in the parent dir, the sub-dirs dont get created in cofnluence

test
├document.md
│doc.md
│do-03.md
test.md

@elijahgagne
Copy link

It seems to work for me.

# Create structure
mkdir test
mkdir test/test-01
echo 'readme02.md' > test/readme02.md
echo 'test.md' > test/test.md
echo 'readme1.md' > test/test-01/readme1.md
echo 'test-02' > test/test-01/test-02
echo 'readme-03.md' > test/test-01/readme-03.md
# Run sync
markdown2confluence -s '~293896096' /tmp/test

You'll note that test-02 doesn't come over because it doesn't have a .md extension.

image

@bir87
Copy link
Author

bir87 commented Sep 16, 2020

is there a limit on how big the directory structure is ? Because it does not work for me like yours.

@elijahgagne
Copy link

None that I know of. Just to be clear, you're using the latest version, follow the commands I pasted above, and still get a different result?

@bir87
Copy link
Author

bir87 commented Sep 17, 2020

so if this page called abs.md already exists in space XYZ .. i cant create a different parent and expect abs.md to be under that parent correct. .. since it already sees inside space XYZ it will just go ahead and update it rather than recreate

@elijahgagne
Copy link

Yes, that's my understanding. This stems from the fact the Confluence does not support two pages with the same name.

@bir87
Copy link
Author

bir87 commented Sep 28, 2020

it looks like it does work for small nested tree structures with few kb of .md files. But will not work for a vast tree structure with multiple md files in each layer.
what is the rest api you are using to create spaces or folder in confluence.

@elijahgagne
Copy link

I am working in a Confluence environment with about 20 people and only a few of us are syncing our changes. I generally write a few pages and then sync them. So I never have a lot of new content that needs to get synced.

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

No branches or pull requests

3 participants