6. Import, Export & Publish

6.1. Import

SnippetsLab allows you to import data from a previously exported SnippetsLab library, or other supported applications and formats. Starting from version 1.5, you can also import snippets from GitHub gists directly.

Choose Library > Import… from the main menu to open the import utility.

6.1.1. Import from SnippetsLab Library

SnippetsLab allows you to import content from its library file (*.snippetslablibrary). Importing a SnippetsLab Library file is equivalent to merging two libraries: all folders, smart groups, and snippets will be added as new, and tags will be merged.

6.1.2. Import from JSON

Starting from version 2.1, you can import from any JSON file as long as it conforms to the required format. This makes it possible to import from arbitrary sources as long as they can be converted to a supported JSON representation.

Importing from a JSON file that was exported with SnippetsLab (version 2.1 and above) is fully supported.

For details about format requirements, see JSON Import Format Specification.

6.1.3. Import from Quiver

Starting from version 2.1, you can import a Quiver library (*.qvlibrary), notebook (*.qvnotebook), or note (*.qvnote) directly.

All notebooks will be converted to folders, and all tags will be preserved. If a note only contains code cells with a single language type, it will be converted to a snippet with the same language (if supported). All other notes are converted to Markdown snippets with equivalent content.

Please note that Quiver’s diagram syntax is not compatible with the Mermaid library used by SnippetsLab. Although the diagram cells will be imported, you may need to update the code for it to render correctly in SnippetsLab.

6.1.4. Import from CodeBox

SnippetsLab supports importing from CodeBox’s library file (*.cbxml) directly.

Notes, folders and tags are preserved. Tabs are converted to fragments, and groups are converted to folders. Smart groups are not supported. Most languages are converted to the corresponding language supported by SnippetsLab, but some languages may be changed to “Plain Text.”

6.1.5. Import from GitHub Gists

SnippetsLab allows you to import from public gists that belong to any account (username). If you are signed in with a GitHub account, you can also import private gists from your own account. It is not possible to import private gists from any other accounts.

To sign in to GitHub, open Preferences… > Accounts, and click Authorize GitHub under the GitHub section.

Note

Due to GitHub restrictions, anonymous users can only send up to 60 requests per hour—this effectively makes it impossible to import more than 60 gists within this time limit. Signing in with your GitHub account will extend this limit to 5,000 requests per hour.

6.2. Export

You can export your library as-is (as a manual backup, or for importing to another computer). SnippetsLab also allows you to export your library to other formats like JSON, XML or as individual text files. To export your library:

  1. Choose Library > Export… from the main menu.

  2. Choose a location and format, then click Export.

shadow

6.3. 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 main menu.

  2. Choose the Accounts tab and click on the Authorize GitHub button.

  3. A new dialog will appear with a one-time authentication code. Click on Copy Code and Open GitHub to open the device login page on github.com.

  4. Paste in your authentication code. In the following page, choose Authorize SnippetsLab.

  5. Return to SnippetsLab, and the authentication process should automatically complete within a few seconds.

SnippetsLab only requires the gist scope, which will grant access to your public and private gists. SnippetsLab does not have access to other contents in your GitHub account, such as your repository or user details.

Publish your snippets as gists.

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

  • 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 publicly or privately.

  • Update Existing Gist: Create a new version for the previously created gist. This option is only available if you have already published the same snippet.

  • 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 (unless you publish it again as a new gist).

Snippets associated with gists will display a GitHub logo in the snippets list:

shadow

Tip

You can create a smart group that collects all snippets associated with GitHub. In the conditions dropdown, select Gist is Yes. You can also restrict the results to a specific gist author, if desired. For details, see Smart Groups.