Skip to end of banner
Go to start of banner

Overview

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

If you're looking for the Snippets for Confluence documentation, it can be found here.

Snippets

The Snippets plugin provides a simple way to create and share code snippets in Bitbucket Server. The plugin allows you to create code snippets and optionally make them available to other users. You can also discover snippets created by other users and add them to your starred snippets collection.

Feature Highlights

  • Store your code snippets in Bitbucket Server
  • Share your code snippets with other users
  • Discover snippets created by other users
  • Star snippets to add them to your own starred snippets collection
  • Simply embed snippets on any website or in Confluence by using our free Snippets for Confluence add-on

Screenshots

How it works

Access your snippets by using the snippets menu in the header of Bitbucket. You can create new snippets directly from the menu or by clicking the create button in the snippets overview. Specify a name and an optional description, which supports Markdown syntax. You can categorize your snippet by assigning one or more categories. Enter new categories separated by commas. You can also control the visibility and accessibility of your snippet:

VisibilityChoose whether your snippet should be visible to all Bitbucket users in the browse section of the snippets overview.

Accessibility

Choose whether your snippet should be accessible for external users you share the snippet URL with.
PermissionsChoose whether certain groups or users have permissions to view your snippets.

Note: If you want to prevent users from making their snippets accessible for external users they share the URL with, Bitbucket administrators can globally disable the option to make individual snippets public in the plugin configuration located under:

Bitbucket Administration > Add-ons > Snippets configuration

A snippet consists of one or more files. Add as many files as you want by clicking the add file button at the bottom of the form or by simply using drag & drop in modern browsers. The syntax highlighting of your snippet code is automatically detected by the ending of the file name.

Markdown files are being rendered directly when viewing a snippet, if the file name has one of the following extensions: .md, .markdown, .mdown, .mkdn or .mkd. Learn more about the supported syntax in the Markdown Syntax Guide.

After you have created your snippet, you can share it with other users by copying the snippet link displayed in the right sidebar of the snippet. Once other users know the URL of your snippet, they can share it as well, add a comment or star it for later use. By starring a snippet, the snippet will be available in your own starred snippets collection. You can also download a snippet with all files as a zip file or view the raw file directly in your browser.

It's even possible to embed a snippet on an external website, on Confluence pages and blogposts by using our free Snippets add-on for Confluence or on a page published in Bitbucket with our Pages add-on by simply using the embed code displayed in the right sidebar of the snippet. And if you only want to embed a single file of the snippet, just add the filename with the file parameter ?file={filename} to the url used in the embed code. Permissions are always inherited from the snippet itself. If you want to embed a snippet on a public website, you need to make the snippet accessible for external users first. Otherwise only logged-in Bitbucket Server users will be able to view the embedded snippet.

Finally you can discover more snippets of other users in the browse snippets section or on the user's profile page.



  • No labels