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
@@ -4,6 +4,10 @@ This guide covers Markdown-specific syntax and formatting conventions used in Co
4
4
5
5
## Table of Contents
6
6
7
+
-[Site structure](#site-structure)
8
+
-[Docs repository](#docs-repository)
9
+
-[Page headings](#page-headings)
10
+
-[Sidebar](#sidebar)
7
11
-[Title](#title)
8
12
-[Headings](#headings)
9
13
-[Text formatting](#text-formatting)
@@ -30,7 +34,7 @@ This guide covers Markdown-specific syntax and formatting conventions used in Co
30
34
-[Tables](#tables)
31
35
-[Markdown tables](#markdown-tables)
32
36
-[HTML tables](#html-tables)
33
-
-[Markdown vs HTML](#markdown-vs-html)
37
+
-[Markdown vs. HTML](#markdown-vs-html)
34
38
-[Images](#images)
35
39
-[Videos](#videos)
36
40
-[Versioning](#versioning)
@@ -46,6 +50,87 @@ This guide covers Markdown-specific syntax and formatting conventions used in Co
46
50
-[Comments](#comments)
47
51
-[TODOs](#todos)
48
52
53
+
## Site structure
54
+
55
+
### Docs repository
56
+
57
+
Documentation for each CockroachDB version is organized in dedicated directories. For example, CockroachDB v23.1 docs are in `src/current/v23.1` and `src/current/_includes/v23.1`, while CockroachDB API docs are in `src/api`.
58
+
59
+
Each page must be a `.md` file written in [Redcarpet](https://github.com/vmg/redcarpet) Markdown. Use lowercase file names with dashes between words.
60
+
61
+
**Example:**`name-of-your-file.md`
62
+
63
+
### Page headings
64
+
65
+
All Markdown pages require YAML front matter:
66
+
67
+
```yaml
68
+
---
69
+
title: Title of Page
70
+
summary: Short description of page for SEO
71
+
---
72
+
```
73
+
74
+
**Required fields:**
75
+
76
+
Field | Description
77
+
------|------------
78
+
`title` | Page heading in title case
79
+
`summary` | SEO meta description (50-160 characters)
80
+
81
+
**Optional fields:**
82
+
83
+
Field | Description | Default
84
+
------|-------------|--------
85
+
`toc` | Auto-generates page table of contents | `true`
86
+
`toc_not_nested` | Limits TOC to h2 headers only | `false`
87
+
`allowed_hashes` | URL hashes that don't correspond to headings | None
Set the page title in the `title:` metadata. The title should be in title case. Heading 1 (`#`) is reserved for page titles and **should not** be used in pages.
@@ -118,7 +203,7 @@ When linking to a versioned page from a Technical Advisory (in `advisories`), ha
118
203
119
204
### Custom anchor links
120
205
121
-
To link to a specific location on a page that is not a heading (e.g., a specific command-line flag in a table), add a manual anchor and use the `id` parameter:
206
+
To link to a specific location on a page that is not a heading (for example, a specific command-line flag in a table), add a manual anchor and use the `id` parameter:
122
207
123
208
**Example:**
124
209
@@ -149,7 +234,7 @@ For websites that automatically localize pages, avoid using localization element
149
234
150
235
### Inline code
151
236
152
-
Use inline code when referring to code, commands, or other technical syntax within a sentence. Inline `code` is surrounded by backticks (``).
237
+
Use inline code when referring to code, commands, values, or other technical syntax within a sentence. Inline `code` is surrounded by backticks (``).
153
238
154
239
**Example:** The `CREATE TABLE` statement creates a new table in a database.
155
240
@@ -213,28 +298,11 @@ Notes for usage:
213
298
-**Copy to Clipboard** should be used for every code block that can be **executed**.
214
299
- To render properly, there must be a line break above the `{% include_cached copy-clipboard.html %}` line.
215
300
216
-
### Placeholders
217
-
218
-
Code samples often include placeholder values, to be replaced by values specific to a user's environment. To denote that a value in a code sample is a placeholder value that should be replaced, use curly brackets (`{}`).
219
-
220
-
For example: `SELECT * FROM TABLE {mytable};`. In this code sample, `{mytable}` would be replaced by some table name before the code could actually run.
221
-
222
-
When you use placeholders, you usually need to define the value within the brackets, if the placeholder value isn't clear. Define placeholder values immediately following the code sample:
223
-
224
-
- For a single placeholder value, use a follow-up sentence.
225
-
- For multiple placeholder values, use a bulleted list.
226
-
- For many placeholder values (10+), use a table.
227
-
- For large code blocks, define the placeholder values inside the code block with an inline code comment.
228
-
229
-
Ensure that placeholders are placed within backticks: `SET {session variable}`. This signifies that placeholder values are code.
230
-
231
-
If the code sample is sensitive to curly bracket characters (e.g., JavaScript), you can use `<>` instead.
232
-
233
301
### Escaping special characters
234
302
235
303
Sometimes you may need to escape special characters to achieve proper rendering:
236
304
237
-
-**Jekyll-reserved characters** (e.g., double `{{ ... }}`) in code blocks: Wrap the specific line(s) with Liquid tags `{% raw %} ... {% endraw %}`.
305
+
-**Jekyll-reserved characters** (for example, double `{{ ... }}`) in code blocks: Wrap the specific line(s) with Liquid tags `{% raw %} ... {% endraw %}`.
238
306
239
307
~~~markdown
240
308
{% raw %}summary: Instance {{ $labels.instance }} has {{ $value }} tripped per-Replica circuit breakers{% endraw %}
@@ -257,7 +325,7 @@ Introduce a list with a sentence and a colon. Use periods at the end of list ite
257
325
258
326
### Ordered lists
259
327
260
-
For each item of a **numbered list**, use `1.` followed by a period and a space, e.g., `1. This is a numbered list item`. The HTML renderer will render the steps in the correct order.
328
+
For each item of a **numbered list**, use `1.` followed by a period and a space, for example, `1. This is a numbered list item`. The HTML renderer will render the steps in the correct order.
261
329
262
330
~~~markdown
263
331
1. This is the first step.
@@ -267,7 +335,7 @@ For each item of a **numbered list**, use `1.` followed by a period and a space,
267
335
268
336
### Unordered lists
269
337
270
-
For each item of a **bulleted list**, use one dash followed by one space, e.g., `- This is a bulleted list item`.
338
+
For each item of a **bulleted list**, use one dash followed by one space, for example, `- This is a bulleted list item`.
271
339
272
340
~~~markdown
273
341
- This is a bullet point.
@@ -343,7 +411,7 @@ Use tables to display structured information in an easy-to-read format. We use t
343
411
344
412
### Markdown tables
345
413
346
-
If you can keep the table formatting simple (e.g., basic text formatting and using `<br>` tags for paragraph breaks), create a table using Markdown. This is the preferred table format.
414
+
If you can keep the table formatting simple (for example, basic text formatting and using `<br>` tags for paragraph breaks), create a table using Markdown. This is the preferred table format.
347
415
348
416
To create a table, use pipes (`|`) between columns and at least 3 dashes (`-`) separating the header cells from the body cells. A return denotes the start of the next row. The text within each column does not need to align in order to be rendered correctly, and you can inline Markdown or HTML.
349
417
@@ -390,12 +458,40 @@ You can use the following HTML formatting within an HTML table:
390
458
- Paragraph breaks (`<p>`)
391
459
- Lists (`<ol>` / `<ul>` / `<li>`)
392
460
393
-
### Markdown vs HTML
461
+
### Markdown vs. HTML
394
462
395
463
- Prefer Markdown syntax over HTML when possible for better readability and maintainability.
396
464
- Use HTML only when Markdown doesn't provide the necessary functionality.
397
465
- When mixing Markdown and HTML, ensure proper spacing and formatting. Preview the rendered page locally.
398
466
467
+
## Callouts
468
+
469
+
CockroachDB docs use three classes of "callouts," which are highlighted blocks of text: tips, notes, and warnings.
470
+
471
+
- To insert a **tip**, use the following code:
472
+
473
+
~~~
474
+
{{site.data.alerts.callout_success}}
475
+
tip text goes here
476
+
{{site.data.alerts.end}}
477
+
~~~
478
+
479
+
- To insert a **note**, use the following code:
480
+
481
+
~~~
482
+
{{site.data.alerts.callout_info}}
483
+
note text goes here
484
+
{{site.data.alerts.end}}
485
+
~~~
486
+
487
+
- To insert a **warning**, use the following code:
488
+
489
+
~~~
490
+
{{site.data.alerts.callout_danger}}
491
+
warning text goes here
492
+
{{site.data.alerts.end}}
493
+
~~~
494
+
399
495
## Images
400
496
401
497
Use the following HTML and Liquid to include an image in a Markdown page:
@@ -476,14 +572,6 @@ A patch release version of CockroachDB receives updates as patches. To refer to
476
572
477
573
## Include files
478
574
479
-
Sometimes content needs to be duplicated across two or more pages in the documentation. For example, there may be several pages that need the same cluster setup, but describe how to use different features. Or a very specific [note](#notes) or [warning](#warnings) needs to be added to several different pages.
480
-
481
-
In these situations, you will need to use an _include file_. An include file is a separate Markdown file (stored in `_includes/some/shared-file.md`) where you will write content that is shared across multiple pages.
482
-
483
-
For more information about include files, see [the Jekyll `include` documentation](https://jekyllrb.com/docs/includes/).
484
-
485
-
_Note_: Using include files adds complexity to the docs site architecture and build process. It also makes writing the documentation more tricky, because instead of working on text in one document, the writer has to jump between two or more files. If you can link to existing content rather than using an include file, strongly consider doing that instead.
486
-
487
575
There are [basic](#basic-include-file-usage) and [advanced](#advanced-include-file-usage) methods for using include files. Use the basic method unless you are sure you need the advanced.
488
576
489
577
<aname="basic-include-file-usage"></a>
@@ -551,36 +639,31 @@ For more information about the `remote_include` tag, see the README in the [jeky
551
639
552
640
### Filter tabs
553
641
554
-
On some pages in our docs, there are tabs at the top of the page that will link to different pages at different hyperlinks. For example, in the [Install CockroachDB docs](https://www.cockroachlabs.com/docs/stable/install-cockroachdb.html), there are links to the Mac, Linux, and Windows pages at the top of the page.
642
+
Use filter tabs to create navigation between related pages. The [`filter-tabs.md`](https://github.com/cockroachdb/docs/blob/main/src/current/_includes/filter-tabs.md) include generates tabs that link to different pages.
555
643
556
-
Use [`filter-tabs.md`](https://github.com/cockroachdb/docs/blob/main/src/current/_includes/filter-tabs.md) to specify these tabs for any `cockroachcloud` docs or docs for CockroachDB v21.2 and later.
644
+
**Note:** Filter tabs link to different URLs/pages, not tabs within a single page.
557
645
558
-
**Note:** this include file only produces tabs that link to different URLs/pages. It cannot be used for creating tabs within a single page.
646
+
**Setup process:**
559
647
560
-
The general process to follow and use this is as follows:
648
+
1. Identify pages for filter tabs and note their HTML filenames (for example, `install-cockroachdb-mac.html`).
561
649
562
-
1. Identify each page to be linked from a filter tab.
563
-
- Make a note of each HTML page filename (e.g., `install-cockroachdb-mac.html`).
564
-
- Draft a tab name (e.g., `Install on <strong>Mac</strong>`)—the text to display on the tab itself. This supports HTML, not Markdown.
565
-
2. Create an include Markdown file within `_includes/<CRDB version>/filter-tabs` with the following structure:
566
-
```
567
-
{% assign tab_names_html = "Tab Name 1;Tab Name 2;Tab Name 3" %}
{% include filter-tabs.md tab_names=tab_names_html page_filenames=html_page_filenames page_folder=<version> %}
571
656
```
572
-
- `tab_names_html` is a semicolon-separated list of the HTML-supported tab names.
573
-
- `html_page_filenames` is a semicolon-separated list of the page filenames with the `.html` extension.
574
-
- `<crdb_version>` is `"cockroachcloud"` (with quotes) for any CockroachDB Cloud docs and `page.version.version` (without quotes) for any versioned docs (v21.2 and later).
575
-
3. For each page listed in `html_page_filenames`, paste `{% include <CRDB version>/filter-tabs/<filter-tab-include>.html %}` in the position where you want the tabs to be included.
657
+
658
+
1. Include the filter tabs on each target page: `{% include <version>/filter-tabs/<name>.html %}`
576
659
577
660
### Technical limitations of include files
578
661
579
662
Include files have the following technical limitations:
580
663
581
-
- They cannot be used in [Markdown tables](#tables). For example, this is why [the guidance about how to use version tags in tables](#version-tags-tables) is provided.
582
-
- A [remote include](#remote-includes) file in another repo that contains an [include file](#include-files) that references something in `cockroachdb/docs` will fail to pull in and render that include file.
583
-
- Include files containing a paragraph followed by a code block do not render correctly in the context of both paragraphs and lists in the files they are included from due to a limitation in our [Markdown](#markdown) renderer.
664
+
- Cannot be used in [Markdown tables](#markdown-tables)
665
+
- Remote includes cannot reference local includes
666
+
- Include files with paragraphs followed by code blocks may not render correctly in all contexts
0 commit comments