Import, Export & Publish¶
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¶
- Choose File > Import… from the menubar, or double click the
- In the import utility window, choose SnippetsLab as the source.
- Review import options.
- Click Import.
Import from CodeBox Library¶
- Choose File > Import… from the menubar.
- In the import utility window, choose CodeBox as the source.
- Review import options.
- Click Import.
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¶
Choose File > Import… from the menubar.
In the import utility window, choose GitHub Gist as the source.
Review import options.
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.
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.
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)
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.
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:
- Choose File > Export… from the menubar.
- Choose a location and format, then click Export.
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¶
- Choose SnippetsLab > Preferences from the menubar.
- Choose the Accounts tab and click on Sign In button.
- If you prefer to sign in with a GitHub Enterprise account, click on Switch to GitHub Enterprise.
- Enter your username and password.
- 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/v3in most cases.
- Click Sign In. If 2FA is enabled, a prompt dialog will appear shortly to let you enter your authentication code.
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:
- 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.