Skip to content

Make it possible to share code snippets #18

Description

@DimitarNestorov

It would be really nice to just copy paste a link in order to share a code snippet online. No need for any backend storage as you can just do the same as the TypeScript playground: store the code after the hash in the URL. And the share button just copy pastes that URL.

Example TypeScript playground URL containing code: https://www.typescriptlang.org/play/?#code/GYVwdgxgLglg9mABMGAjAFGAXIsIC2qApgE4CUiA3gFCKIA2RUiA2gIYA0iqAuogLysADFwCMPANy1EAdwAWMRokwBaFRXZdeA1qi5tEAam6TpJJiBJI2UgL7VqAekeIAiiBgQA1oihEAzlD+WNQQCP5wjAB09HAA5ugoGEJkZBJ0zohCoeGRRDHxiWjooqnpiJmiOWAR0bEJSSUpaRUuAKxt1EA

The TypeScript playground uses lzstring specifically to produce a shorter URL: https://github.com/microsoft/TypeScript-website/blob/1e7ea49f60953aa446b591c6aff347a7c566e3cb/packages/sandbox/src/compilerOptions.ts#L84-L152

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions