Confluence Import Markdown



Confluence backend generates confluence articles and uploads them on your confluence server. It can create and edit pages in Confluence with content based on your Foliant project.

It also has a feature of restoring the user inline comments, added for the article, even after the commented fragment was changed.

Import Markdown files with tables and code block You can import files in bulk, thus you save time and increase productivity. It replaces old add-on: Universal Importer for Confluence. Import almost any file format to Confluence. A protip by avgp about martin-n, atlassian, gliffy, and confluence. Markdown to Confluence Convertor. Recently in Confluence 4.0 the Wiki Markup Editor was removed for various engineering reasons. Embed a diagram in GitHub markdown. Mass import Gliffy diagrams to draw.io in Confluence Cloud.

This backend adds the confluence target for your Foliant make command.

Installation¶

The backend requires Pandoc to be installed on your system. Pandoc is needed to convert Markdown into HTML.

Usage¶

To upload a Foliant project to Confluence server use make confluence command:

Config¶

You have to set up the correct config for this backend to work properly.

Specify all options in backend_config.confluence section:

passfile
Path to YAML-file holding credentials. See details in Supplying Credentials section. Default: confluence_secrets.yml
host
Required Host of your confluence server.
login
Login of the user who has permissions to create and update pages. If login is not supplied, it will be prompted during the build.
password
Password of the user. If the password is not supplied, it will be prompted during the build.
id
ID of the page where the content will be uploaded. Only for already existing pages
title
Title of the page to be created or updated.

Remember that page titles in one space must be unique.

space_key
The space key where the page(s) will be created/edited. Only for not yet existing pages.
parent_id
ID of the parent page under which the new one(s) should be created. Only for not yet existing pages.
parent_title
Another way to define the parent of the page. Lower priority than paren_di. Title of the parent page under which the new one(s) should be created. The parent should exist under the space_key specified. Only for not yet existing pages.
test_run
If this option is true, Foliant will prepare the files for uploading to Confluence, but won't actually upload them. Use this option for testing your content before upload. The prepared files can be found in .confluencecache/debug folder. Default: false
notify_watchers
If true — watchers will be notified that the page has changed. Default: false
toc
Set to true to add a table of contents to the beginning of the document. Default: false
nohead
If set to true, first title will be removed from the page. Use it if you are experiencing duplicate titles. Default: false
restore_comments
Attempt to restore inline comments near the same places after updating the page. Default: true
resolve_if_changed
Delete inline comment from the source if the commented text was changed. This will automatically mark the comment as resolved. Default: false
pandoc_path
Path to Pandoc binary (Pandoc is used to convert Markdown into HTML).
verify_ssl
If false, SSL verification will be turned off. Sometimes when dealing with Confluence servers in Intranets it's easier to turn this option off rather than fight with admins. Not recommended to turn off for public servers in production. Default: true
attachments
List of files (relative to project root) which should be attached to the Confluence page.
codeblocks
Configuration for converting Markdown code blocks into code-block macros. See details in Code blocks processing sections.

User's guide¶

Uploading articles¶

By default, if you specify id or space_key and title in foliant.yml, the whole project will be built and uploaded to this page.

If you wish to upload separate chapters into separate articles, you need to specify the respective id or space_key and title in meta section of the chapter.

Meta section is a YAML-formatted field-value section in the beginning of the document, which is defined like this:

or like this:

The result of the above examples will be exactly the same. Just remember that first syntax, with three dashes --- will only work if it is in the beginning of the document. For all other cases use the meta-tag syntax.

If you want to upload a chapter into confluence, add its properties under the confluence key like this:

Important notice!Both modes work together. If you specify the id1 in foliant.yml and id2 in chapter's meta — the whole project will be uploaded to the page with id1, and the specific chapter will also be uploaded to the page with id2.

NoticeYou can omit title param in metadata. In this case section heading will be used as a title.

If you want to upload just a part of the chapter, specify meta tag under the heading, which you want to upload, like this:

In this example, only the Components section with all its content will be uploaded to Confluence. The My document heading will be ignored.

Creating pages¶

If you want a new page to be created for content in your Foliant project, just supply in foliant.yml the space key and a title that does not yet exist in this space. Remember that in Confluence page titles are unique inside one space. If you use a title of an already existing page, the backend will attempt to edit it and replace its content with your project.

Example config for this situation is:

Now if you change the title in your config, confluence will create a new page with the new title, leaving the old one intact. Evernote clipper edge.

Import

If you want to change the title of your page, the answer is in the following section.

Updating pages¶

Generally to update the page contents you may use the same config you used to create it (see the previous section). If the page with a specified title exists, it will be updated.

Also, you can just specify the id of an existing page. Remote server for mac. After build its contents will be updated.

This is also the only way to edit a page title. If title param is specified, the backend will attempt to change the page's title to the new one:

Updating part of a page¶

Confluence backend can also upload an article into the middle of a Confluence page, leaving all the rest of it intact. To do this you need to add an Anchor into your page in the place where you want Foliant content to appear.

  1. Go to Confluence web interface and open the article.
  2. Go to Edit mode.
  3. Put the cursor in the position where you want your Foliant content to be inserted and start typing {anchor to open the macros menu and locate the Anchor macro.
  4. Add an anchor with the name foliant.
  5. Save the page.

Now if you upload content into this page (see two previous sections), Confluence backend will leave all text which was before and after the anchor intact, and add your Foliant content in the middle.

You can also add two anchors: foliant_start and foliant_end. In this case, all text between these anchors will be replaced by your Foliant content.

Known issue: right now this mode doesn't work with layout sections. If you are using sections, whole content will be overwritten.

Inserting raw confluence tags¶

If you want to supplement your page with confluence macros or any other storage-specific HTML, you may do it by wrapping them in the <raw_confluence></raw_confluence> tag.

For example, if you wish to add a table of contents into the middle of the document for some reason, you can do something like this:

In version 0.6.15 we've added an experimental feature of automatically escaping <ac:..></ac:..> tags for you. So if you want to insert, say, an image with native Confluence tag ac:image, you don't have to wrap it in raw_confluence tag, but keep in mind following caveats:

  • singleton ac:.. tags are not supported, so <ac:emoticon ac:name='cross' /> will not work, you will have to provide the closing tag: <ac:emoticon ac:name='cross'></ac:emoticon>,
  • only ac:.. tags are escaped right now, other confluence tags like ri:.. or at:.. are left as is. If these tags appear inside ac:.. tag, it's ok. If otherwise, ac:.. tag appears inside at:.. or ri:.. tag, everything will break.

Attaching files¶

To attach an arbitrary file to Confluence page simply put path to this file in the attachments parameter in foliant.yml or in meta section.

This will just tell Foliant to attach this file to the page, but if you want to reference it in text, use the other approach:

Insert Confluence ac:link tag to attachment right inside your Markdown document and put local path to your file in the ri:filename parameter like this:

In this case Foliant will upload the presentation.pdf to the Confluence page and make a link to it in the text. The path in ri:filename parameter should be relative to current Markdown file, but you can use !path, !project_path modifiers to reference images relative to project root.

Advanced images¶

Confluence has an ac:image tag which allows you to transform and format your attached images:

  • resize,
  • set alignment,
  • add borders,
  • etc.

Since version 0.6.15 you have access to all these features. Now instead of plain Markdown-image syntax you can use native Confluence image syntax. Add an ac:image tag as if you were editing page source in Confluence interface and use local relative path to the image as if you were inserting Markdown-image.

Confluence Export Markdown

Confluence Import Markdown

For example, if you have an image defined like this:

and you want to resize it to 600px and align to center, replace it with following tag:

As you noticed, you should put path to your image right inside the ri:filename param. This path should be relative to current Markdown file, but you can (since 0.6.16) use !path, !project_path modifiers to reference images relative to project root.

Here's a link to Confluence docs about ac:image tag and all possible options.

If you want to upload an external image, you can also use this approach, just insert that proper ac:image tag, no need for raw_confluence:

Code blocks processing¶

Since 0.6.9 backend converts Markdown code blocks into Confluence code-block macros. You can tune the macros appearance by specifying some options in codeblocks config section of Confluence backend

theme
Color theme of the code blocks. Should be one of:
  • emacs,
  • django,
  • fadetogrey,
  • midnight,
  • rdark,
  • eclipse,
  • confluence.
title
Title of the code block.
linenumbers
Show line numbers in code blocks. Default: false
collapse
Collapse code blocks into a clickable bar. Default: false

Right now Foliant only converts code blocks by backticks/tildes (tabbed code blocks are ignored for now):

Syntax name, defined after backticks/tildes is converted into its Confluence counterpart. Right now following syntaxes are supported:

  • actionscript,
  • applescript,
  • bash,
  • c,
  • c,
  • coldfusion,
  • cpp,
  • cs,
  • css,
  • delphi,
  • diff,
  • erlang,
  • groovy,
  • html,
  • java,
  • javascript,
  • js,
  • perl,
  • php,
  • powershell,
  • python,
  • xml,
  • yaml.
Confluence export markdown

Supplying Credentials¶

There are several ways to supply credentials for your confluence server.

1. In foliant.yml

The most basic way is just to put credentials in foliant.yml:

It's not very secure because foliant.yml is usually visible to everybody in your project's git repository.

2. Omit credentials in config

A slightly more secure way is to remove password or both login and password from config:

In this case Foliant will prompt for missing credentials during each build:

In simple terms, a log sheet is a blank sheet on which various logs are entered. A log sheet may be used for a large number of purposes. If you’re a perfectionist, you would want to carry out all your activities in an organized manner. That way, you reduce chances of errors as well. Call Log Template. Keep track of client calls with this free online Call Log Template. Most businesses use a log sheet to keep track of chronological notes or incidents that happen in the place of work. This professional activity becomes essential for checking purposes when problems occur. The log sheet template will provide information about. Fillable and printable Log Sheet 2021. Fill, sign and download Log Sheet online on Handypdf.com. Workout log sheet exercise.

3. Using environment variables

Foliant 1.0.12 can access environment variables inside config files with !env modifier.

Confluence import markdown

Now you can add these variables into your command:

Or, if you are using docker:

4. Using passfile

Finally, you can use a passfile. Passfile is a yaml-file which holds all your passwords. You can keep it out from git-repository by storing it only on your local machine and production server.

To use passfile, add a passfile option to foliant.yml:

The syntax of the passfile is the following:

For example:

If there are several records for a specified host in passfile (like in the example above), Foliant will pick the first one. If you want specific one of them, add the login parameter to your foliant.yml:

Confluence Import Markdown Table

Credits¶

The following wonderful tools and libraries are used in foliantcontrib.confluence:

  • Atlassian Python API wrapper,
  • BeautifulSoup,
  • PyParsing,
  • Pandoc.