RittmanMead / md_to_conf

Markdown to Confluence import
MIT License
232 stars 83 forks source link

Implemented an ability to create page to page links in confluence #23

Closed OlegKarasik closed 1 year ago

OlegKarasik commented 4 years ago

Here is the use case: imagine you have a repository with a lot of .md files. These .md files have references to each other, and now you want to migrate or synchronize these .md files with confluence.

Here is how you can do it by specifying the following parameter (there could be many --pages-map parameters):

python ... --pages-map https://bitbucket/repo/path=C:\document\repo

This will trigger the following routine:

  1. Find all links to .md files i.e. <a href="https://bitbucket/repo/file.md">Title</a>.
  2. Match these links to values specified in --pages-map parameter i.e. all <a href="https://bitbucket/repo/.."> which starts from https://bitbucket/repo/path will be matched.
  3. Try to find local representation of files by appending rest of link to second part of --pages-map i.e. https://bitbucket/repo/file.md will become C:\document\repo/file.md
  4. Read the first line (i.e. file title)
  5. Find confluence page by title
  6. Replace link with confluence link
Introduced parameters: Name Description
--pages-map can be specified multiple times, each time it specifies a separate url to local directory map

P.S. This PR also includes changes from #21 and #22 (sorry for such a burden).