diff options
-rw-r--r-- | doc/user/img/gitlab_snippet_embedded.png | bin | 0 -> 31251 bytes | |||
-rw-r--r-- | doc/user/snippets.md | 18 |
2 files changed, 18 insertions, 0 deletions
diff --git a/doc/user/img/gitlab_snippet_embedded.png b/doc/user/img/gitlab_snippet_embedded.png Binary files differnew file mode 100644 index 00000000000..74c6204d2e0 --- /dev/null +++ b/doc/user/img/gitlab_snippet_embedded.png diff --git a/doc/user/snippets.md b/doc/user/snippets.md index 2170b079f62..8847044b911 100644 --- a/doc/user/snippets.md +++ b/doc/user/snippets.md @@ -27,3 +27,21 @@ Personal snippets are not related to any project and can be created completely i You can download the raw content of a snippet. By default snippets will be downloaded with Linux-style line endings (`LF`). If you want to preserve the original line endings you need to add a parameter `line_ending=raw` (eg. `https://gitlab.com/snippets/SNIPPET_ID/raw?line_ending=raw`). In case a snippet was created using the GitLab web interface the original line ending is Windows-like (`CRLF`). + + +## Embedding snippets + +Public snippets can not only be shared, but also embedded on any website. This allows to reuse a GitLab snippet in multiple places and any change to the source is automatically reflected in the embedded snippet. + +Embedded snippets are displayed with a header that shows the file name if defined, the snippet size, a link to GitLab and the actual snippet content. Actions in the header allow users to see the snippet in raw format and download it. + + + +To embed a snippet, you can simply click on the "Copy to clipboard" button in the "Embed" section on top. This copies a one-line script that you can add to any website or blog post. + +### Example snippet +```html +<script src="https://gitlab.com/namespace/project/snippets/SNIPPET_ID.js"></script> +``` + +This feature is available for public snippets only.
\ No newline at end of file |