summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axil@gitlab.com>2018-05-24 14:10:55 +0200
committerAchilleas Pipinellis <axil@gitlab.com>2018-05-24 17:47:49 +0200
commite230eaf19c6fd63c76416bc4041547916f4d09c6 (patch)
treea9d3d7dd044c37d9d16ad8442602b8fe914b9625
parent866b7797b6ecc339a1ae6ec512786749f6db2a1c (diff)
downloadgitlab-ce-add-embedded-snippets-docs.tar.gz
Copyedit embedding snippets docsadd-embedded-snippets-docs
-rw-r--r--doc/user/img/gitlab_snippet_embedded.pngbin31251 -> 13688 bytes
-rw-r--r--doc/user/snippets.md27
2 files changed, 20 insertions, 7 deletions
diff --git a/doc/user/img/gitlab_snippet_embedded.png b/doc/user/img/gitlab_snippet_embedded.png
index 74c6204d2e0..6246a198848 100644
--- a/doc/user/img/gitlab_snippet_embedded.png
+++ b/doc/user/img/gitlab_snippet_embedded.png
Binary files differ
diff --git a/doc/user/snippets.md b/doc/user/snippets.md
index d6b0dbb60f0..5758720fe9e 100644
--- a/doc/user/snippets.md
+++ b/doc/user/snippets.md
@@ -28,20 +28,33 @@ 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.
+> Introduced in GitLab 10.8.
-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.
+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 snippet](img/gitlab_snippet_embedded.png)
+To embed a snippet, first make sure that:
+
+- The project is public (if it's a project snippet)
+- The snippet is public
+- In **Project > Settings > Permissions**, the snippets permissions are
+ set to **Everyone with access**
-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.
+Once the above conditions are met, the "Embed" section will appear in your snippet
+where you can simply click on the "Copy to clipboard" button. This copies a one-line
+script that you can add to any website or blog post.
+
+Here's how an example snippet would look like:
-### 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
+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.
+
+![Embedded snippet](img/gitlab_snippet_embedded.png)