Embedded Snippets in GitLab and Externally
## Problem to Solve Snippets have limited usefulness outside of the context of the Snippet due to a lack of interactive sharing options. Currently within GitLab users can only link to a Snippet, but users following that link will navigate away from the context the Snippet was provided to them. Externally, Snippets only support the function of embedding through our non-standard JavaScript. This limits the use to places where users can source 3rd party JavaScript on a page. ## Vision We want Snippets to be the defacto standard for creating small pieces of code that need to be shared with others and then collaborated on. ## Proposal GitLab should be embed-able within various contexts of the larger GitLab application as well as externally. There are two key benefits to this: 1. Snippets become the SSOT for sharing anything code related within GitLab that isn't part of the main project. Practically users could use a single Snippet and link that in a comment, issue, wiki or other type of content in GitLab. When that Snippet is updated all references to the Snippet would have the latest content ensuring that users were always seeing the correct content. 1. External embeds are important for developers who are sharing their work with other users either on a blog or some other service. By creating a native embed experience as well as supporting standards like [oEmbed](https://oembed.com/) and 3rd party providers like [Embedly](https://embed.ly/providers/new) Snippets can become a valuable way to share and then collaborate on that content. ### What might this look like? - **Wiki:** Linking to a snippet in a page on the Wiki would render the snippet inline and allow users to visit the edit page to modify or make changes. This would ensure the same content of the snippet was used in every place that it might be referenced across a wiki. Compared to the current situation where users might use code blocks inside of Markdown and need to update that everywhere. - **Issue/Merge Request:** Linking to a Snippet in the comment of an issue would provide people a clear way to discuss some kind of patch or other script necessary to the project and then continue to provide the correct Snippet to users when discussions were complete. The current situation may result in code blocks inside of Markdown, or sharing of files back and forth as attachments. - **External Embeds:** Snippets could be used and embedded on a wide variety of services/sites across the internet. Specifically things like Medium/Blogs where users might be writing tutorials and sharing sample code. Supporting Embeds can also be valuable in the context of Reddit/Stackoverflow/Forums where users might be interested in sharing something with others to help provide solutions/feedback. # Related: linking to any code https://gitlab.com/gitlab-org/gitlab/-/issues/22156+
epic