Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated content as per MARK-371

...

You can pull Markdown from other applications like GitHub, Bitbucket, or GitLab, or, from a URL, or directly in the macro body. The list of macros and how to add one to a page are as shown in the image:You can find information about both cloud and server/datacenter (DC) versions here.

Feature

Server/DC

Cloud

Authorizing app to access data

You must create a personal access token to be able to access your data. Read more in the Configuration page.

You need to authorize the app to be able to access your data stored in other applications. Read more in the Configuration page.

Adding a macro to the page

Image AddedmdExt_cld_macrosList.pngImage Modified

Select any of the links to learn more:

Table of Contents
minLevel1
maxLevel6
include
outlinefalse
indent
styledefault
exclude
typelist
class
printablefalse

Markdown

  1. Add the Markdown macro to the required Confluence page.

  2. Then In cloud, paste your content into the macro editor :

    Image Removed

    Or, you can or macro body, and in server, write/paste the content directly in the macro on the page as shown:body.

  3. Click Insert and publish the page.

Markdown from Github

  1. Add the Markdown from Github macro to the required Confluence page.

  2. Select the Github token from the list and enter the path of the Markdown file to be displayed in URL.

    mdExt_cld_macro_GH.pngImage Removed

    Administrators configure these tokens from the Markdown Extensions Configuration page.

  3. Click Insert and publish the page.

Markdown from Bitbucket

...

Differences between server/DC and cloud macros

Feature

Server/DC

Cloud

Macro editor

Image AddedImage Added

Server/DC macro parameters

Parameter name

Description

Enable extended Markdown properties:

Select the checkbox to use a different parser, flexmark-java, to display Markdown content on your page. For more details about the parser, read the flexmark-java article.

Linkify Headers

Select the checkbox to allow headers in your content to be clickable.

Markdown from a URL

  1. Add the Markdown from a URL macro to the required Confluence page.

    mdExt_cld_macro_BB.gifImage Removed
  2. Select the token in Bitbucket token and URL in the Enter URL tab. Click Check to check the connection.

  3. Enter the required information in the Enter Repository Settings tab and click InsertIn cloud, the macro is displayed as a sidebar in the right (see the image in the table below).

  4. Add your URL to the URL parameter. Make sure your URL is pointing to raw Markdown!
    In the cloud version, the changes made to the editor are always saved automatically. In server/DC, click Insert to add the macro to the page.

  5. Publish the page to view see the accessed data.

...

  1. content.

Differences between server/DC and cloud macros

Feature

Server/DC

Cloud

Macro editor

Image AddedmdExt_cld_macro_URL.pngImage Added

Server/DC macro parameters

Parameter name

Description

URL

Enter

URL tab

Bitbucket token

Specify the Bitbucket account to be accessed. Administrators configure these tokens from the Markdown Extensions Configuration page. This parameter is common to both the tabs.

URL

Enter the full path to the required Markdown file. This is a mandatory field. If a URL is provided, the settings in the Enter Repository Settings tab can be skipped.

Click Check to test the connection and accessibility.

Enter Repository Settings tab

Username/Organization Name

Enter the username or organization name under which the repository is hosted.

For example: https://bitbucket.org/ mohamicorp/search-for-stash, where, the username is mohamicorp.

This is a mandatory field.

Repository

Specify the repository to be accessed. For example: https://bitbucket.org/mohamicorp/ search-for-stash

This is a mandatory field.

Branch or Commit Hash

Specify the branch from where the file is available. For example: master

This is a mandatory field.

File Path

Enter the directory path where the file is hosted. For example: src/main/resources/README.md

This is a mandatory field.

Markdown from Gitlab

...

Add the Markdown from Gitlab macro to the required Confluence page.

...

the URL of the Markdown file to be rendered. Ensure the URL points to the raw Markdown file.

Enable extended Markdown properties:

Select the checkbox to use a different parser, flexmark-java, to display Markdown content on your page. For more details about the parser, read the flexmark-java article.

Linkify Headers

Select the checkbox to allow headers in your content to be clickable.

Security token

Select the token to be used to access the required Markdown file at the relevant location. Administrators configure the tokens in the Configuration screen.

Accessing Markdown content with this macro

The steps to access your content using the Markdown from a URL macro are as follows:

  1. Create the security token from the relevant hosting type. This is explained in detail in the Configuration screen. Administrators create these tokens which are then populated in the Security token dropdown list.

  2. Enter the file path to the Markdown file to be displayed.

Before you begin

  • Before you enter the URL for a repository, ensure that it is a raw URL.
    A raw URL is defined as the part of the URL following the domain information and includes the query string, if present. For example, in the URL string http://www.contoso.com/articles/recent.aspx , the raw URL is /articles/recent.aspx

  • How to identify if a file is valid for the macro?

    Paste the file link into your browser's address bar. If the actual code is displayed in the browser, it is considered to be invalid or in an incorrect format. If the file downloads to your system, the macro can process the file and its contents.

  • Know what is a complete URL.

    • A typical path for the raw file on GitLab looks like:
      /projects/:id/repository/files/:file_path/raw

    • Since the host address begins with:
      https://gitlab.com/api/v4

    • The complete URL, in this example, looks like: 
      https://gitlab.com/api/v4/projects/:id/repository/files/:file_path/raw?ref=master

  • For private Bitbucket repositories (from third party applications):

    Use the following URL path to connect to a private Bitbucket repository if logging in from third party applications such as Google:

    https://api.bitbucket.org/2.0/repositories/$workspace/$repo/src/$commit/$filepath

    The path to be specified in the URL parameter looks like the following example:

    https://api.bitbucket.org/2.0/repositories/appfire/ac-app-dist/src/17f199444d1386c543ac642e9155b396aaeca403/README.md

Example

Let’s assume that you want to display a file from a private Bitbucket repository (sample URL: https://api.bitbucket.org/2.0/repositories/bobswift-test/private_test_repo/src/master/README.md).

On the relevant page:

...

  1. Add the macro, and select the required security token.

  2. Enter the URL of the required Markdown file.

  3. Select/deselect the Enable extended Markdown properties: and/or Linkify Headers as required.

  4. Insert the macro and publish the page.

If the selected token and the URL are valid, the specified Markdown file is displayed on the page. The process to display content from other hosting types are the same: select the security token and provide the raw URL.

Cloud macros

There are three cloud macros available with this app. They are:

  • Markdown from Github

  • Markdown from Bitbucket

  • Markdown from Gitlab

Adding a cloud macro to a page

The process of adding a macro to a page is the same for all macros.

  1. Add either of the macros to the required Confluence page.

  2. Select the Github Token, Bitbucket Token, or, the Github Token from the list and enter the path of the Markdown file to be displayed in URL.

  3. Click Check to check the connection.

  4. Enter the required information in the Enter Repository Settings tab and click Insert.

  5. Publish the page to view the accessed data.

Each of the macros look similar and have similar parameters. For example, a Markdown from Bitbucket macro is as follows:

...

Common parameters

The only difference between the macros is the parameter where you must select the token. The following table explains each parameter in the macro editor:

...

Parameter name

Description

Enter URL tab

Github Token
Bitbucket Token
Gitlab Token

Specify the relevant GitHub/Bitbucket/GitLab account to be accessed. Administrators configure these tokens from the Markdown Extensions Configuration page. This parameter is common to both

the

tabs.

URL

Enter the URL of the Markdown file to be displayed. The URL can be a link to either a regular or a raw file. If a URL is provided, the settings in the Enter Repository Settings tab can be skipped.

For example: https://gitlab.com/mohami/smarter-search-for-bitbucket/-/blob/master/README.md

This is a mandatory field.

Enter Repository Settings tab

Username/Organization Name

Enter the username or organization name under which the repository is hosted.

For example

: https

:

//gitlab.com/

mohami

/smarter-search-for-bitbucket, where the username is mohami.

This is a mandatory field.

Repository

Specify the repository name to be accessed.

For example:

In https://gitlab.com/mohami/smarter-search-for-bitbucket, where the repository is 

smarter-search-for-bitbucket

.

This is a mandatory field.

Branch or Commit Hash

Enter the branch name where the file is located. For example: master

This is a mandatory field.

File Path

Enter the directory path where the file is hosted. For example: src/main/resources/README.md

This is a mandatory field

.

Markdown from a URL

...

Add the Markdown from a URL macro to the required Confluence page. The macro is displayed as a sidebar in the right:

...

Add your URL to the URL parameter. The changes made to the editor are always saved automatically. Make sure your URL is pointing to raw Markdown!

.

Additional resources