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

confluence-space-key is not being picked up in markdown document #53

Open
golharam opened this issue Sep 22, 2024 · 2 comments
Open

confluence-space-key is not being picked up in markdown document #53

golharam opened this issue Sep 22, 2024 · 2 comments

Comments

@golharam
Copy link

Hi - I'm trying to use this tool to publish a README.md to our enterprise Confluence. At the top of my README.md, I have the following:

<!-- confluence-parent-id: 421855570 -->
<!-- confluence-page-id: 445939968 -->
<!-- confluence-space-key: NWP -->
<!-- generated-by: Do not edit. This page was auto-generated from the pipeline repo. -->

When I run md2conf README.md, the confluence-space-key does not get picked up, I get an error:
md2conf.properties.ConfluenceError: Confluence space key not specified

I have to specify the space key as an environment variable, CONFLUENCE_SPACE_KEY.

I traced through the code and it appears as though if the environment variable is not set, the markdown is not checked for 'confluence-space-key'.

I also noticed in

self.space_key = opt_space_key

that self.space_key = opt_space_key is done 3 times in a row.

@hunyadi
Copy link
Owner

hunyadi commented Sep 22, 2024

Some of the document properties are deferrable. For example, a page doesn't need to have an explicit parent, it is enough if it gets assigned a parent (explicitly, or via a root page ID, or via inheritance from an ancestor) at the time content is generated. If the page is evaluated in a context where it has to have a parent (e.g. when exporting a directory hierarchy), and it turns out that it does not, a run-time error is raised.

Other document properties are overridable but not deferrable. For example, Confluence space key is a required parameter that you must set at the time the conversion is triggered. The value you set via the configuration options is the default Confluence space that you can in turn override in Markdown documents. If you don't override, the default space key is automatically applied. This ensures that all documents have a Confluence space key, and a run-time error due to missing space key is never triggered.

Confluence space key could be made a deferrable property with some changes to the code. However, you can emulate the behavior if you set a dummy space key in environment variables. This is how unit and integration tests work in md2conf, they use an otherwise meaningless dummy space key.

@golharam
Copy link
Author

golharam commented Sep 22, 2024

It would be nice if the space key as specified in the document is used instead of having to explicitly set one when running md2conf. Using a dummy space key is fine, but is confusing. Right now I'm setting the space key, both in the document and the environment, but find this duplicative.

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

2 participants