If you're looking for the Snippets for Confluence documentation, it can be found here.
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
Screenshot Walkthrough
How it works
Creating and Editing Snippets
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:
Visibility | Choose 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. |
Permissions | Choose 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.
Sharing Snippets
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. You can use Bitbucket @mentions feature to notify and involve users to snippet discussion. 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.
Ownership of the Snippets
There are three groups of users that have full access and rights to administer the snippet:
Author of the snippet
Administrators of Bitbucket
Users/groups set as owners on snippet settings
Ownership of the snippet overrides “Limit access“ field setting, meaning users that belong to any of those groups will have access and permission to administer snippet even if they are not granted access by “Limit access“ snippet settings field.