Skip to content

Commit 8ef71e3

Browse files
Update gist instructions
1 parent 231eaf7 commit 8ef71e3

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

Diff for: docs/embed-files.md

+20-11
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,31 @@ Embedding any type of source code file, you can specify the highlighted language
9595

9696
## Embed a gist
9797

98-
You can embed a gist as markdown content or as a code block. No plugin or app config change is needed - just an element which follows the formatting covered in [Embed files](#embed-files) and uses a raw gist URL.
98+
You can embed a gist as markdown content or as a code block - this is based on the approach in the [Embed files](#embed-files) but uses raw gist URL as the target.
99+
100+
?> No plugin or app config change is needed here. In fact, an "Embed" script tag that is copied from a gist will _not_ load even if you make plugin or config changes to allow the external script.
101+
102+
### Identify gist metadata
99103

100104
Start by viewing a gist on `gist.github.com`.
101105

102-
For the purposes of the examples below, we assume is this is a valid gist URL.
106+
For the purposes of this guide, we assume that is this is a valid gist URL:
103107

104108
- https://gist.github.com/docsify/c2bece08f27c4277001f123898d16a7c
105109

106-
Identify the following:
110+
Identify the following from the gist:
107111

108112
- **Github username** - e.g. `docsify`
109113
- **Gist ID** - e.g. `c2bece08f27c4277001f123898d16a7c`
110114
- **Filename** - choose any valid filename in the gist e.g. `instructions.md`
111115

112-
Next, you can create the full URL for the file on the `gist.githubusercontent.com` domain. See below for markdown or codeblock approaches.
116+
Now you can create the _raw gist URL_ for the file on the `gist.githubusercontent.com` domain.
117+
118+
For example:
119+
120+
- https://gist.githubusercontent.com/docsify/c2bece08f27c4277001f123898d16a7c/raw/instructions.md
121+
122+
Continue with one of the the sections below to actually embed the gist on a Docsify page.
113123

114124
### Render markdown content from gist
115125

@@ -121,29 +131,28 @@ Here is the format:
121131
[LABEL](https://gist.githubusercontent.com/USERNAME/GIST_ID/raw/FILENAME ':include')
122132
```
123133

124-
Note that the `LABEL` will be the fallback text if the link is broken - so if the filename is there it helps for debugging.
125-
126-
Using the example case, the element would be:
134+
Using the example case, the element on your page would be:
127135

128136
```markdown
129137
[instructions.md](https://gist.githubusercontent.com/docsify/c2bece08f27c4277001f123898d16a7c/raw/instructions.md ':include')
130138
```
131139

140+
?> The the `LABEL` will be the fallback text if the link is broken, so it is useful to repeat the filename in the label.
141+
132142
### Render codeblock from gist
133143

134-
Embed a gist on your Docsify page as a code block. The format is the same as the previous section except it just has `:type=code` added on in the alt text.
144+
Embed a gist on your Docsify page as a code block. The format is the same as the previous section, but with `:type=code` added to the alt text.
135145

136-
As with the [Embedded file type](#embedded-file-type) section, the syntax highlighting will be inferred from the extension (e.g. `.js` or `.py`) so you can leave the type as `code`.
146+
?> As with the [Embedded file type](#embedded-file-type) section, the syntax highlighting will be inferred from the extension (e.g. `.js` or `.py`) so you can leave the type as the generic value of `code`.
137147

138148
Here is the format:
139149

140150
```markdown
141151
[LABEL](https://gist.githubusercontent.com/USERNAME/GIST_ID/raw/FILENAME ':include :type=code')
142152
```
143153

144-
Using the example case, the element would be:
154+
Using the example case, the element on your page would be:
145155

146156
```markdown
147157
[instructions.md](https://gist.githubusercontent.com/docsify/c2bece08f27c4277001f123898d16a7c/raw/instructions.md ':include :type=code')
148158
```
149-

0 commit comments

Comments
 (0)