A V1 Dendron Pod to publish notes to your personal Confluence space.
cd {workspace}
{workspace} $ npm init -y
{workspace} $ npm install --global @dendronhq/dendron-cli
{workspace} $ npm install --save @tomduffield/confluence-pod
~/code $ git clone https://github.com/tduffield/confluence-pod.git
~/code/confluence-pod $ yarn install
~/code/confluence-pod $ npm link
{workspace} $ npm init -y
{workspace} $ npm install --global dendron-cli
{workspace} $ npm link confluence-pod
cd {workspace}
dendron publishPod \
--wsRoot . \
--vault vault \
--podId dendron.confluence \
--podPkg @tomduffield/confluence-pod \
--podSource custom \
--configPath './pods/dendron.confluence/config.yml' \
--query '<YOUR_NOTE>'
You can copy and paste this function into your shell profile (e.g., ~/.bashrc
) to give yourself a nifty helper. Just replace {workspace}
with the fully-qualified path to your Dendron workspace. You can also replace the fallback vault
value to whatever your default vault might be.
function publish-note-to-confluence() {
query="$1"
vault="${2:-vault}"
workspace="{workspace}"
dendron-cli publishPod --wsRoot "$workspace" --vault "$vault" \
--podId dendron.confluence --podPkg @tomduffield/confluence-pod --podSource custom \
--configPath "${workspace}/pods/dendron.confluence/config.yml" \
--query "$query"
}
Create the Pod configuration file in ./pods/dendron.confluence/config.yml
.
username: <your_email>
password: <your_api_key>
baseUrl: https://<your_organization>.atlassian.net
space: "~012345678" # e.g., "~[0-9]{9}"
parentPageId: "0123456789" # e.g., "[0-9]{10}"
includeNote: false
Option | Description | Default |
---|---|---|
username | The username you use to log in to Confluence (typically your email) | required |
password | An API Token you generated | required |
baseUrl | The domain root for your Confluence installation | required |
space | The reference to the space where you want to upload | required |
parentPageId | The page under which all pages are published | None: uploads directly to the space. |
includeNote | Whether or not to include an info panel at the top of the page indicating the page is exported from Dendron | false |
Atlassian Confluence's Storage Format is XHTML based, which means that Dendron's built-in HTML processor gets us 95% of the way there. Where there are exceptions, this Pod leverages a custom unified plugin to re-process the HTML appropriately.
Format Type | Status |
---|---|
Basic HTML | ✅ |
Task Lists | 🚧 |
Link to Another Confluence Page | ✅ |
Attached Image | ✅ |
External Image | ✅ |
Image Attributes | 🚧 |
- Exported notes do not include the Children or Backlink sections. This is something we'd like to support in the future however.
- All notes are currently published as children pages to your
parentPageId
. We do not re-create your hierarchy (yet). - This pod has only been tested on the Confluence Cloud.
If you include a reference to another note that is also published to Confluence (i.e., the note has a pageId
in its frontmatter), then this pod should properly create an <ac:link>
to that page. Otherwise, this pod will leave the the <a>
tag alone and it should get stripped out by Confluence (leaving just the text).
This pod will upload any referenced images from ./assets
as attachments and convert the <img>
element to <ac:image>
.
If you set includeNote
in your config to true
, this pod will prepend an info block to the top of your page indicating that this note was exported from Dendron and that changes made to the page directly may be overwritten.
The most likely bug you'll run into once you get things working is com.atlassian.confluence.api.service.exceptions.BadRequestException: Content body cannot be converted to new editor format
. This means that there's something in the HTML that Confluence doesn't like. This means that there's probably an edge case that I haven't caught (apologies).