You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/contributing/writing-for-github-docs/using-markdown-and-liquid-in-github-docs.md
+70Lines changed: 70 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,6 +144,76 @@ Code annotations only work in articles with the `layout: inline` frontmatter pro
144
144
145
145
For an example of an article that uses code annotations on {% data variables.product.prodname_docs %}, see [AUTOTITLE](/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions).
146
146
147
+
## {% data variables.product.prodname_copilot_short %} prompts
148
+
149
+
Prompts for {% data variables.product.prodname_copilot_short %} can either be displayed in blocks or included inline within text.
150
+
151
+
### Prompt blocks
152
+
153
+
These are very similar to code blocks, but use the `copilot` keyword rather than the name of a programming language.
154
+
155
+
Prompt blocks should always have a copy button, added using the `copy` option, and may also have a {% data variables.product.prodname_copilot_short %} button, added using the `prompt` option. The {% data variables.product.prodname_copilot_short %} button gives the reader a quick way to run the prompt in {% data variables.copilot.copilot_chat_short %} on {% data variables.product.prodname_dotcom_the_website %}. The `copy` and `prompt` options can be used in any order.
156
+
157
+
#### Example prompt block with {% data variables.product.prodname_copilot_short %} and copy buttons
158
+
159
+
````markdown
160
+
```copilot prompt copy
161
+
What is git?
162
+
```
163
+
````
164
+
165
+
This is rendered as:
166
+
167
+
```copilot prompt copy
168
+
What is git?
169
+
```
170
+
171
+
You should only add a {% data variables.product.prodname_copilot_short %} button to a prompt block if:
172
+
* The prompt can be run without any further context (as shown in the example above).
173
+
* There is a code block in the same article that provides the required context for the prompt.
174
+
175
+
#### Including context with a prompt
176
+
177
+
If you use a {% data variables.product.prodname_copilot_short %} button, you can add context to the prompt that is sent to {% data variables.copilot.copilot_chat_short %} by referencing a code block in the same article. You do this by adding `id=STRING-OF-YOUR-CHOICE` to the code block and `ref=STRING-OF-YOUR-CHOICE` to the prompt block.
178
+
179
+
#### Example code block used as context within a prompt block
180
+
181
+
````markdown
182
+
Add an id to the code block whose code you want to add to the prompt as context:
183
+
184
+
```javascript id=js-age
185
+
function logPersonsAge(a, b, c) {
186
+
if (c) {
187
+
console.log(a + " is " + b + " years old.");
188
+
} else {
189
+
console.log(a + " does not want to reveal their age.");
190
+
}
191
+
}
192
+
```
193
+
194
+
Then, elsewhere in the same article, reference the id in the prompt block:
195
+
196
+
```copilot copy prompt ref=js-age
197
+
Improve the variable names in this function
198
+
```
199
+
````
200
+
201
+
There are many examples of prompt blocks with context in the {% data variables.product.prodname_copilot_short %} Cookbook. For example, see [AUTOTITLE](/free-pro-team@latest/copilot/tutorials/copilot-chat-cookbook/refactor-code/improve-code-readability).
202
+
203
+
### Inline prompts
204
+
205
+
For most inline prompts, mark these by using backticks, just like inline code.
206
+
207
+
If the prompt does not require any context, you can add a clickable {% data variables.product.prodname_copilot_short %} icon after the prompt. This allows the reader to run the prompt in {% data variables.copilot.copilot_chat_short %} on {% data variables.product.prodname_dotcom_the_website %}. To add the clickable icon, surround the prompt with Liquid syntax tags:
208
+
209
+
```markdown
210
+
{% raw %}... you can click {% prompt %}what is git{% endprompt %} to run this ...{% endraw %}
211
+
```
212
+
213
+
This is rendered as:
214
+
215
+
... you can click {% prompt %}what is git{% endprompt %} to run this ...
216
+
147
217
## Octicons
148
218
149
219
Octicons are icons used across {% data variables.product.prodname_dotcom %}’s interface. We reference Octicons when documenting the user interface and to indicate binary values in tables. Find the name of specific Octicons on the [Octicons site](https://primer.style/octicons).
0 commit comments