Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The existing solution with chain methods of document build is well suited for cases when the document structure is predetermined, like so:
However, if you need to create a document programmatically, when parts of the document can be repeated or generated independently, a problem arises of how to embed pre-created structures of nodes into the document. When, for example, some nodes must be included in the document under a certain condition, and otherwise must be omitted.
The existing model of document creation does not allow this.
I faced this problem personally when creating articles on Confluence, and thought it would be nice to have it in the library itself.
My proposal is to allow two alternative ways of constructing a document, one existing through a chain of calls, and one through a direct append of nodes.
In this case, it will be possible to create and append nodes dynamically.
This will allow to create documents of any complexity and will give developers a powerful tool for working with Atlassian products.
This doesn't require much, just change the visibility scope for method append to public. I also added the ability to append multiple nodes at once.