Include from GitHub to Confluence
Breadcrumbs

Include file ☁️


You can include files from a GitHub repository in order to have an up-to-date version of it in a Confluence page. The macro will feature syntax highlighting for the included file and the possibility to export it in PDF or Word.

To include a file you can:

  • simply paste the URL

  • add the macro and specify additional options


For files that are within private repositories, users will need to authenticate to view the files' content. More information in this section.


Include file by pasting the file’s URL

You can simply copy the URL of the GitHub file and paste it into the Confluence page.

In the following example we use this GitHub URL of a .js file:

4ce71a2f-9539-4c3e-a68a-f1b714147d46.png

We then simply paste the URL in the Confluence file as shown in the video and the macro will automatically be applied to embed the file.

include-github-file-gif (1).gif


To edit the macro’s options listed in the next section, you can click on the edit button present on the macro when editing the page.


Include file by adding the macro

You can also add the macro to set further options.

You can add the macro either by:

  • typing directly /Github File and ENTER to add and edit the macro.

  • using the Insert button from the editor toolbar and then picking the Github File macro from the “External Content” category of the macro library.

include-github-file-page.png
Select the macro


You will then be able to specify the following:

URL

URL of the file

Syntax highlighting

Format/ language for highlighting purposes (auto detect is performed by default)

Title

Your title for the macro

Show line number

Tick to display number of lines in the file

Collapsible

Collapses the file content and gives the option to expand and collapse


Demo videos


Here is a Demo Video on How to include content from your Git repositories directly into Confluence, using major hosting services like Bitbucket, GitLab, and GitHub. As simple as copy-pasting Bitbucket URLs or GitHub, GitLab links, you can easily integrate and render files in various formats, including Markdown, AsciiDoc, PlantUML diagrams, images, and more.