Insert Code from Git

Code from Github into Confluence

#Before you start

  • Connect your Git account and ensure access to the target repo/branch.

#Examples of supported file types

  • Code: .js, .ts, .tsx, .py, .java, .c, .cpp, .cs, .go, .rs, .rb, .php, .swift, .kt, .scala, .sh, .bash, .zsh, .sql, .r, .m, .pl, .lua, .dart, .vue

  • Config/Data: .json, .yaml, .yml, .toml, .ini, .cfg, .conf, .env

  • Markup/Styles: .html, .htm, .xml, .svg, .css, .scss, .sass, .less

  • Plain text: files without a known extension are shown as text when possible

Not supported for inline preview (you can still reference them): .pdf, .doc(x), .xls(x), .ppt(x), archives like .zip, .tar, .gz, .bz2, .7z, .rar, executables/installers like .exe, .dll, .dmg, .pkg, .iso, and .wasm.

#Insert steps

  1. Insert the Github File Macro

Insert Code from Github into Confluence
  1. Connect/select your account and pick the repository and branch.

Configure Code from Github into Confluence
  1. Browse to the file and select it, or paste it’s URL in the input

Insert code from Github to Confluence
  1. (Optional) Set the title and toggle any available display options (e.g., line numbers where applicable).

  2. Insert to embed the file.

Code from Github to Confluence

#How it renders

  • Recognized languages are syntax-highlighted for readability.

  • Large files or very long lines may be truncated for performance.

#Permissions

  • Viewers need their own access to the repository to see the embedded content.

#Troubleshooting

  • File doesn’t preview: Verify the extension is supported for inline view or download/reference it instead.

  • Missing file: Confirm branch selection and path accuracy.