hunyadi / md2conf

Publish Markdown files to Confluence wiki
MIT License
50 stars 27 forks source link

external links to anchor in another markdown file in same repository #54

Open golharam opened 1 week ago

golharam commented 1 week ago

I have a README.md that contains a link to another markdown file within the same repo:

[Link to other file](OTHER_FILE.md)

The OTHER_FILE.md is part of the same repo. I've added a confluence-page-id, confluence-space-key tag to the top of that markdown and already published it to Confluence. Now, when I try to publish my README.md, I get the error: m2conf.converter.DocumentError: unable to find matching page for URL: OTHER_FILE.md

How do you handle links like this?

golharam commented 1 week ago

I see in sample/example.md: Relative links to other pages are also supported if you are synchronizing a directory tree, not a single file.

Maybe this is the solution? If I want to publish the README.md and all markdown files it is associated with?

hunyadi commented 1 week ago

Today, you should synchronize a directory tree to tackle this scenario. md2conf is currently implemented to take two passes: first, it scans a directory hierarchy to extract metadata; second, it generates XHTML (Confluence Storage Format) for the documents it has found. Relative links to other documents are resolved with the help of the metadata index created in the first phase. If you are converting a single document, no index is used.

In a future version, we may implement a reference graph in which outbound links are traversed, and documents with no inbound links are skipped. Currently, no such reference graph is built, and all documents in a directory hierarchy are discovered recursively, and published.