6. Import, Export, and Publish

6.1. Import

SnippetsLab supports importing data from various sources:

  • SnippetsLab Library: Import a SnippetsLab library file (.snippetslablibrary) merges two libraries, including all folders, smart groups, snippets, and tags.

  • Plain Text Files: Import .txt files and other plain text source files. SnippetsLab automatically detects the appropriate language for these files based on the file extension.

  • JSON: Import from any JSON file that conforms to the required format. This allows you to import data from any source, provided they can be converted to the supported JSON structure. See JSON Import Format Specification for details on the specification.

  • Quiver: Import a Quiver library (.qvlibrary), notebook (.qvnotebook), or note (.qvnote). Notebooks will become folders, and all tags will be imported as well. Notes that only contains code cells with a single language are converted to snippets with the same language, while other notes are converted to Markdown snippets. Note: Quiver’s diagram syntax may require adjustments for use with SnippetsLab’s Mermaid library.

  • CodeBox: Import .cbxml files from the CodeBox app. Notes, folders, and tags are preserved; tabs become fragments, and groups are imported as folders. Most languages are converted to their SnippetsLab equivalents, but some may import as plain text. Note that smart groups are not supported.

  • GitHub Gists: Import public gists from any account. If you are signed into a GitHub account in Settings > Integrations, you can also import your own private gists.

    Note

    GitHub imposes an API rate limit allowing anonymous users up to 60 requests per hour. Signing into your GitHub account extends this limit to 5,000 requests per hour.

To import:

  • Select Library > Import… from the menu bar.

  • Choose the source and import options.

  • Click Import.

6.2. Export

You can export your library as-is as a manual backup, or for use on another computer, or export it in other formats like JSON, XML, or as individual text files. To export:

  • Select Library > Export… from the menu bar.

  • Choose a location and export format.

  • Click Export.

6.3. Publish Gist to GitHub

Directly publish your snippets SnippetsLab to GitHub as gists.

  • To sign in with your GitHub account, follow these steps:

    • Go to Settings > Integrations.

    • Click Authorize GitHub….

    • A dialog will appear with a one-time code. Click Copy Code and Open GitHub to open the GitHub login page.

    • Log in if needed, then paste the authentication code and select Authorize SnippetsLab.

    • Return to SnippetsLab; authentication should complete automatically in a few seconds.

    SnippetsLab only requires the gist scope, which grants access to your public and private gists. The app does not have access to other parts of your GitHub account, such as repositories or profile information.

  • To publish a snippet as gist: Right-click a snippet in the snippets list and select the GitHub sub-menu. Then, choose from the following:

    • Create New Gist: Publish the snippet as a new gist, with the option to set it as public or private.

    • Update Existing Gist: Update a previously published gist with a new revision.

  • To open the gist in GitHub: Right-click a snippet in the snippets list and choose GitHub > Open in GitHub.

    You can also copy the gist link to the clipboard with Copy GitHub Gist Link.

  • To unlink a snippet with GitHub: Right-click a snippet in the snippets list and choose GitHub > Unlink with GitHub.

    This action only removes the association within SnippetsLab and does not delete the gist from GitHub.

Tip

You can create a smart group that displays all snippets associated with gists. In smart group conditions, select Gist is Yes. You can also filter by specific gist authors, if desired. Refer to Smart Groups for additional details.