Import, Export & Publish

Import

You can import your library if you have a exported library file from another computer or app. The files can be SnippetsLab library file package (*.snippetslablibrary) or CodeBox library file (*.cbxml). From version 1.5, you can also import snippets from GitHub gists.

Import from SnippetsLab Library

  1. Choose File > Import… from the menubar, or double click the *.snippetslablibrary file.
  2. In the import utility window, choose SnippetsLab as the source.
  3. Review import options.
  4. Click Import.

Import from CodeBox Library

  1. Choose File > Import… from the menubar.
  2. In the import utility window, choose CodeBox as the source.
  3. Review import options.
  4. Click Import.

Note

Notes, folders and tags from CodeBox are preserved. Tabs are converted to fragments, and groups are converted to folders. Smart Groups aren’t supported. Most languages are converted to the corresponding language that is supported by SnippetsLab, but some languages (including all languages that aren’t supported) will be changed to “Plain Text.”

Import from GitHub Gists

  1. Choose File > Import… from the menubar.

  2. In the import utility window, choose GitHub Gist as the source.

  3. Review import options.

  4. If you choose to import from your own GitHub or GitHub Enterprise account while no valid account was added to SnippetsLab, click Add GitHub Account to sign in with your GitHub account.

  5. Otherwise, click Next to begin fetching gists.

    • If you are not signed in, you can import public gists from any account. If you are signed in with a GitHub or GitHub Enterprise account, you can import public and private gists from your own account. It’s not possible to import private gists from an account that’s not yours.
  6. In the appeared dialog, choose all gists that you want to import to SnippetsLab. (To open a gist using your browser, choose the gist and click Open in Browser button)

  7. Click Import.

Tip

Due to GitHub restrictions, anonymous users can only send up to 60 requests per hour. This make it impossible to import more than 60 gists within the time limit if you are not signed in with your GitHub account. If this bothers you, please sign in with your GitHub account to extend this limit to 5,000 requests per hour.

Export

You can export your library as-is and then import it on another computer. Or, export your library to other formats like XML, JSON or plain text files. To export your library:

  1. Choose File > Export… from the menubar.
  2. Choose a location and format, then click Export.
_images/6-export.png

Publish Gist to GitHub

You can publish your snippets to GitHub as gists directly from SnippetsLab. To do that, you need to sign in with your GitHub account first.

Sign In with Your GitHub Account

  1. Choose SnippetsLab > Preferences from the menubar.
  2. Choose the Accounts tab and click on Sign In button.
  3. If you prefer to sign in with a GitHub Enterprise account, click on Switch to GitHub Enterprise.
  4. Enter your username and password.
  5. If you are signing in with a GitHub Enterprise account, also fill in the address of your server’s API endpoint. Note that the address should be in the form of http(s)://hostname/api/v3 in most cases.
  6. Click Sign In. If 2FA is enabled, a prompt dialog will appear shortly to let you enter your authentication code.
_images/github-signin.png

Note

For GitHub.com users, the password is only used to authenticate your identity with the server and is never stored anywhere in your computer. For GitHub Enterprise users, the password is securely stored in OS X Keychain. You can remove it at any time.

Publish Your Snippets as Gists

Right-click on a snippet from the snippets list and choose GitHub sub-menu from the contextual menu. There are four possible options:

_images/2250c.png
  • Open in GitHub: Open the previously published gist in GitHub. It will only be available after publishing this snippet as a gist.
  • Create New Gist: Publish the selected snippet as a new gist in GitHub. You can choose whether to publish it as a public or a private gist.
  • Update Existing Gist: Create a new version for the previously created gist in GitHub. This option is only available after publishing this snippet as a gist.
  • Unlink with GitHub: Forget about the previously published gist for this snippet. You will not be able to open it in GitHub or update the existing gist before publishing it again.