|
| 1 | +- [Globally available components](#globally-available-components) |
| 2 | + - [Video](#video) |
| 3 | + - [Usage](#usage) |
| 4 | + - [Intro](#intro) |
| 5 | + - [Usage](#usage-1) |
| 6 | + - [Steps](#steps) |
| 7 | + - [Usage](#usage-2) |
| 8 | + - [Step](#step) |
| 9 | + - [Usage](#usage-3) |
| 10 | +- [A code example](#a-code-example) |
| 11 | +- [Another code example](#another-code-example) |
| 12 | + - [Code blocks](#code-blocks) |
| 13 | + - [Usage](#usage-4) |
| 14 | + - [Callouts](#callouts) |
| 15 | + - [Usage](#usage-5) |
| 16 | + - [Announcement Banner](#announcement-banner) |
| 17 | + |
| 18 | +# Globally available components |
| 19 | + |
| 20 | +## Video |
| 21 | + |
| 22 | +`<Video />` component provides formatting for videos in markdown. |
| 23 | + |
| 24 | +### Usage |
| 25 | + |
| 26 | +The Video component requires two props: |
| 27 | + |
| 28 | +- `id`: the video ID |
| 29 | +- `type`: the host of the video. Accepted values are: |
| 30 | + - `wistia` |
| 31 | + - `youtube` |
| 32 | + |
| 33 | +```md |
| 34 | +<Video id="zxunt1u1as" type="wistia"/> |
| 35 | +``` |
| 36 | + |
| 37 | +## Intro |
| 38 | + |
| 39 | +The `<Intro />` component provides formatting for the title and introduction of the markdown document. |
| 40 | + |
| 41 | +### Usage |
| 42 | + |
| 43 | +It takes the title provided in the Frontmatter and accepts plain text for the description. An example of Frontmatter that will have a title of **Example Guide**: |
| 44 | + |
| 45 | +``` |
| 46 | +--- |
| 47 | +path: '/example' |
| 48 | +duration: '30 min' |
| 49 | +title: 'Example Guide' |
| 50 | +template: 'GuideTemplate' |
| 51 | +description: 'Example guide page' |
| 52 | +--- |
| 53 | +``` |
| 54 | + |
| 55 | +It also accepts a `<Video />` component as a child, which it will place on the left side of the description. |
| 56 | + |
| 57 | +```md |
| 58 | +<Intro> |
| 59 | +This is a description for the markdown guide. |
| 60 | + |
| 61 | +<Video id="zxunt1u1as" type="youtube"/> |
| 62 | +</Intro> |
| 63 | +``` |
| 64 | + |
| 65 | +If there is a more than plain text and a `<Video />` (such as a code snippet or another component) the content will be posted on the left side below the description. |
| 66 | + |
| 67 | +## Steps |
| 68 | + |
| 69 | +The `<Steps />` is a required container for the individual `<Step />` components and will autonumber from top to bottom. |
| 70 | + |
| 71 | +### Usage |
| 72 | + |
| 73 | +The Steps component accepts `<Step/>` components as its children and will increment by the number of child components. |
| 74 | + |
| 75 | +```md |
| 76 | +<Steps> |
| 77 | + |
| 78 | +<Step> |
| 79 | + |
| 80 | +## Step 1 |
| 81 | + |
| 82 | +Step 1 description. |
| 83 | +</Step> |
| 84 | + |
| 85 | +<Step> |
| 86 | + |
| 87 | +## Step 2 |
| 88 | + |
| 89 | +Step 2 description |
| 90 | +</Step> |
| 91 | + |
| 92 | +</Steps> |
| 93 | +``` |
| 94 | + |
| 95 | +If there is markdown content not wrapped by a `<Step />` component, it will still auto-increment for that content, so be sure to wrap all content with the Step component. For example: |
| 96 | + |
| 97 | +```md |
| 98 | +<Steps> |
| 99 | + |
| 100 | +<Step> |
| 101 | +This will read as Step 1 of 3. |
| 102 | +</Step> |
| 103 | + |
| 104 | +This will display as is with no step counter. |
| 105 | + |
| 106 | +<Step> |
| 107 | +This will read as Step 3 of 3. |
| 108 | +</Step> |
| 109 | + |
| 110 | +</Steps> |
| 111 | +``` |
| 112 | + |
| 113 | +## Step |
| 114 | + |
| 115 | +### Usage |
| 116 | + |
| 117 | +The `<Step />` component renders a single step in the series of steps. This is |
| 118 | +meant to use in conjunction with `<Steps />`, so this component **MUST** be |
| 119 | +wrapped by `<Steps />` to work properly. The following example will contain 2 |
| 120 | +steps: |
| 121 | + |
| 122 | +```md |
| 123 | +<Steps> |
| 124 | + <Step>Some information about step 1</Step> |
| 125 | + <Step>Some information about step 2</Step> |
| 126 | +</Steps> |
| 127 | +``` |
| 128 | + |
| 129 | +The previous example will interpret the text inside of the `<Step />` as plain |
| 130 | +text. If you would like the `<Step />` component to interpret the text as |
| 131 | +markdown content, include a line break after the opening tag: |
| 132 | + |
| 133 | +```md |
| 134 | +<Step> |
| 135 | + |
| 136 | +# This is a title for the step. |
| 137 | + |
| 138 | +This is some information about this step. |
| 139 | +</Step> |
| 140 | +``` |
| 141 | + |
| 142 | +You can intersperse code blocks inside of the step. Code snippets will always |
| 143 | +render in a right column next to the description. |
| 144 | + |
| 145 | +````md |
| 146 | +<Step> |
| 147 | + |
| 148 | +# A code example |
| 149 | + |
| 150 | +Run the following command in your terminal: |
| 151 | + |
| 152 | +```shell |
| 153 | +npm start |
| 154 | +``` |
| 155 | + |
| 156 | +</Step> |
| 157 | +```` |
| 158 | + |
| 159 | +You can include multiple code blocks in a single step. Code blocks will always |
| 160 | +be rendered to the right of the text that precedes it. |
| 161 | + |
| 162 | +````md |
| 163 | +<Step> |
| 164 | + |
| 165 | +# Another code example |
| 166 | + |
| 167 | +Run the following in your terminal: |
| 168 | + |
| 169 | +```shell |
| 170 | +npm start |
| 171 | +``` |
| 172 | + |
| 173 | +When that is running, edit index.js and replace the component with the following |
| 174 | +code: |
| 175 | + |
| 176 | +```js |
| 177 | +return <div>Hello, {props.name}</div>; |
| 178 | +``` |
| 179 | + |
| 180 | +</Step> |
| 181 | +```` |
| 182 | + |
| 183 | +You can also use images in steps. To get an image to appear on the right side as with code blocks, you must use an HTML `img` tag, traditional markdown will not align the image to the right. |
| 184 | + |
| 185 | +```md |
| 186 | +<Step> |
| 187 | + |
| 188 | +# Image example |
| 189 | + |
| 190 | +A step description |
| 191 | +<img src="../images/folder/great-img.png" alt="and here's an image to follow"> |
| 192 | + |
| 193 | +</Step> |
| 194 | +``` |
| 195 | + |
| 196 | +> Note: keep in mind that a new line is necesary after an `img` tag to ensure proper rendering of subsequent text/markdown. |
| 197 | +
|
| 198 | +## Code blocks |
| 199 | + |
| 200 | +Code blocks are automatically formatted by three backticks. This is our preferred method to delineate code snippets, but it's worth noting that markdown will also consider any text that is indented 4 spaces (or 1 tab) to be a code block. |
| 201 | + |
| 202 | +### Usage |
| 203 | + |
| 204 | +There are four props that can be supplied to a code snippet. |
| 205 | + |
| 206 | +- `language`: The first prop must be a code language. [Here](https://prismjs.com/#supported-languages) is a list of accepted languages for syntax highlighting. |
| 207 | + |
| 208 | + ````md |
| 209 | + ```jsx |
| 210 | + ``` |
| 211 | + ```` |
| 212 | + |
| 213 | +- `lineNumbers`: `true` or `false`. Will show line numbers of the left side of the code, defaults to `false`. |
| 214 | + |
| 215 | + ````md |
| 216 | + ```jsx lineNumbers=true |
| 217 | + ``` |
| 218 | + ```` |
| 219 | + |
| 220 | +- `lineHighlight`: Will highlight lines of code in the snippet. You can supply individual line numbers separted by commas, or ranges by using a hyphen. Be sure not to use any spaces. |
| 221 | + |
| 222 | + ````md |
| 223 | + ```jsx lineHighlight=1,3,6-8,10 |
| 224 | + ``` |
| 225 | + ```` |
| 226 | + |
| 227 | +- `copy`: `true` or `false`. Will display or not display the copy button, defaults to `true` |
| 228 | + ````md |
| 229 | + ```jsx copy=false |
| 230 | + ``` |
| 231 | + ```` |
| 232 | + |
| 233 | +## Callouts |
| 234 | + |
| 235 | +Callouts direct your attention to information of special importance or to information that doesn't fit smoothly into the main text. |
| 236 | + |
| 237 | +- Caution: Screams at you that this could cause a crash or cost you data loss beyond the task at hand. |
| 238 | +- Important: Urges awareness that this could impair the task at hand or cost you time if you ignore the text. |
| 239 | +- Tip: Whispers to you that this is nice to know, like a shortcut, best practice, or reminder. |
| 240 | + |
| 241 | +### Usage |
| 242 | + |
| 243 | +```md |
| 244 | +<Caution> |
| 245 | + |
| 246 | +Text with `markdown`. |
| 247 | + |
| 248 | +</Caution> |
| 249 | + |
| 250 | +<Important> |
| 251 | + |
| 252 | +Text with `markdown`. |
| 253 | + |
| 254 | +</Important> |
| 255 | + |
| 256 | +<Tip> |
| 257 | + |
| 258 | +Text with `markdown`. |
| 259 | + |
| 260 | +</Tip> |
| 261 | +``` |
| 262 | + |
| 263 | +All callouts have default titles that can be overridden like this: |
| 264 | + |
| 265 | +```md |
| 266 | +<Caution title="A custom title"> |
| 267 | + |
| 268 | +Text |
| 269 | + |
| 270 | +</Caution> |
| 271 | +``` |
| 272 | + |
| 273 | +## Announcement Banner |
| 274 | + |
| 275 | +To utilize the announcement banner that is available in the Global Theme please see these |
| 276 | +[instructions](https://github.com/newrelic/gatsby-theme-newrelic/tree/develop/packages/gatsby-theme-newrelic#announcements). |
0 commit comments