pegasd / md2conf

Convert Markdown to XHTML ready to be posted to Confluence
MIT License
2 stars 1 forks source link

Push support? #4

Open joshk0 opened 5 years ago

joshk0 commented 5 years ago

Cool project. To get feature parity with nicr9/md2conf (you might also want to consider a name change), is this library capable of pushing the actual article out to Confluence? If not, is there an example of how you would do it after generating the XHTML?

pegasd commented 5 years ago

Wow, thanks for your interest! This gem was never meant to push to Confluence directly. There is another higher-level module https://github.com/v0v04ka/puppet2conf that uses md2conf to render markdown files and also generate Puppet module documentation.

Considering some interest in this feature, I might implement it, but can't promise it will be done any time soon.

Here's a very rough workaround you can use for now to push to confluence using puppet2conf gem as well as md2conf:

require 'puppet2conf'

xhtml = Md2conf.parse_markdown(File.read('README.md'), max_toc_level: 3)

# make sure '~/.puppet2conf.yaml' exists at this point and is a valid YAML file
# it can contain any (or all) of the settings specified here as parameters
doc_pusher = Puppet2conf::DocPusher.new(username: 'MyUser', password: 'MyPassword',
url: 'https://confluence.example.com', ancestor: 'My Ancestor Page', space: 'My Space')

doc_pusher.push_page('My Page', xhtml, 'My Ancestor Page')