Skip to content

Commit 82ca617

Browse files
kfranqueiroiadawn
andauthored
README: Add instructions for creating each entry type (#323)
Co-authored-by: Kevin White <[email protected]>
1 parent f35bbb0 commit 82ca617

File tree

1 file changed

+113
-11
lines changed

1 file changed

+113
-11
lines changed

README.md

Lines changed: 113 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,25 @@ Additional directories with special meaning:
5252
- `{requirement-or-assertion-name}.md` - Defines content of an individual requirement or assertion
5353
- `terms/` - Contents of terms defined in the Glossary
5454

55-
### Notable subdirectories under `src`
55+
### Notable Subdirectories under `src`
5656

5757
- `src/lib/` - contains files that contribute to Astro build or template logic
5858
- `markdown/` - contains files implementing remark and rehype plugins, to transform output of
5959
Markdown files
6060

6161
## Editing the Guidelines
6262

63-
### Supported fields
63+
### Supported Fields
6464

65-
This section explains the fields available to frontmatter defined at the top of markdown files
65+
This section explains the fields available to frontmatter defined at the top of Markdown files
6666
for guidelines, requirements/assertions, and terms, and within JSON files for groups.
6767

6868
For those unfamiliar with the term, frontmatter refers to YAML written at the top of a file,
6969
surrounded on each side by a line consisting of 3 hyphens.
7070

7171
See existing files under the `guidelines` folder for examples.
7272

73-
#### Common fields
73+
#### Common Fields
7474

7575
These are available to multiple data types, as specified in each respective section below.
7676

@@ -92,7 +92,7 @@ Represents each third-level heading that multiple guidelines are grouped under.
9292
Each group is defined in a JSON file, with its child guidelines located in a
9393
subdirectory with the same name.
9494

95-
- Supports common fields: `children`, `status`
95+
- Supports [common fields](#common-fields): `children`, `status`
9696
- No additional unique fields
9797

9898
#### Guidelines
@@ -101,17 +101,19 @@ Represents each fourth-level heading that multiple requirements/assertions are
101101
listed under. Each guideline is defined in a Markdown file, with its child
102102
requirements/assertions located in a subdirectory with the same name.
103103

104-
- Supports common fields: `children`, `howto`, `status`, `title`
104+
- Supports [common fields](#common-fields): `children`, `howto`, `status`, `title`
105105
- No additional unique fields
106106

107107
#### Requirements and Assertions
108108

109109
Represents each fifth-level heading specifying an individual requirement or assertion.
110110

111-
- Supports common fields: `howto`, `status`, `title`
111+
- Supports [common fields](#common-fields): `howto`, `status`, `title`
112112
- `needsAdditionalResearch` - Optional boolean, indicating whether to
113113
display a "needs additional research" editor's note
114114
- `type` - Optional string: `foundational`, `supplemental`, or `assertion`
115+
- If not specified, the entry will be rendered as "Requirement"
116+
(with neither "Foundational" nor "Supplemental" qualification)
115117

116118
#### Terms
117119

@@ -126,7 +128,7 @@ Represents each `dt`/`dd` pair appearing in the Glossary section.
126128

127129
### Additional Markdown features
128130

129-
#### Definition lists
131+
#### Definition Lists
130132

131133
Definition lists can be specified directly in Markdown via the following format:
132134

@@ -143,11 +145,11 @@ Another shared term
143145
: Another shared definition
144146
```
145147

146-
### Custom directives for guidelines Markdown
148+
### Custom Directives for Guidelines Markdown
147149

148150
For more concrete examples, search for these directives in the repository.
149151

150-
#### Decision trees
152+
#### Decision Trees
151153

152154
The following block will be transformed into a decision tree `details` element,
153155
with "Which foundational requirements apply" summary automatically included:
@@ -193,7 +195,7 @@ Your content here
193195
:::
194196
```
195197

196-
#### Glossary term references
198+
#### Glossary Term References
197199

198200
The text inside `:term[...]` will be transformed into a link referencing a term in the glossary,
199201
and can be used inline within blocks of text:
@@ -202,6 +204,106 @@ and can be used inline within blocks of text:
202204
... is :term[programmatically determinable].
203205
```
204206

207+
## Creating New Entries
208+
209+
General notes:
210+
211+
- All instructions/examples in this section operate within the `guidelines` folder
212+
- File and folder names should be in [kebab-case](https://developer.mozilla.org/en-US/docs/Glossary/Kebab_case) (all lowercase, hyphen-delimited)
213+
- [See `title` under Common Fields](#common-fields) above regarding how
214+
entry names map to titles by default, and how to override with a custom title
215+
- Remember to add appropriate frontmatter; see the subsection under
216+
[Supported Fields](#supported-fields) for the relevant entry type
217+
- Other existing entries may be helpful to look at as examples, especially with
218+
regard to JSON or frontmatter syntax
219+
220+
### New Group
221+
222+
For illustrative purposes, this refers to the new group as `group-name`.
223+
224+
To create a new top-level group:
225+
226+
1. Under the `groups` folder, create a subfolder for the new group
227+
(e.g. `groups/group-name`)
228+
1. Also under the `groups` folder (not the new subfolder),
229+
create a JSON file with the same basename as the new subfolder
230+
(e.g. `groups/group-name.json`), with the following content:
231+
```json
232+
{
233+
"children": [
234+
]
235+
}
236+
```
237+
1. Edit `index.json` (directory under the top-level `guidelines` folder)
238+
to add an entry in its `children` array for the new group
239+
(again using the same basename, e.g. `group-name`)
240+
- This is what makes the group appear in the document structure,
241+
and determines its order among the other top-level groups
242+
1. Follow the instructions below to create at least one guideline
243+
within the group, and at least one requirement or assertion within
244+
each guideline
245+
246+
### New Guideline
247+
248+
For illustrative purposes, this refers to the existing parent group as `group-name`
249+
and the new child guideline as `guideline-name`.
250+
251+
To create a new guideline:
252+
253+
1. Under the desired group's folder, create a subfolder for the guideline
254+
(e.g. `groups/group-name/guideline-name`)
255+
1. Edit the JSON file for the group (e.g. `groups/group-name.json`)
256+
to add an entry in its `children` array for the new guideline
257+
(again using the same basename, e.g. `guideline-name`)
258+
- This is what makes the guideline appear in the document structure,
259+
and determines its order among the other guidelines under the same group
260+
1. Also under the group's folder (not the new subfolder),
261+
create a Markdown file with the same basename as the new subfolder
262+
(e.g. `groups/group-name/guideline-name.md`)
263+
- To prevent the build from failing before any requirements or assertions are added,
264+
include the following initial content:
265+
```
266+
---
267+
children: []
268+
---
269+
270+
@@ add guideline text here
271+
272+
```
273+
We will expand `children` to a multi-line list when adding requirements/assertions.
274+
Note that including some content after the frontmatter is also necessary for the build to function.
275+
1. Follow the instructions below to create at least one requirement
276+
or assertion within the guideline
277+
278+
### New Requirement or Assertion
279+
280+
For illustrative purposes, this refers to the existing parent guideline as `guideline-name`,
281+
its parent group as `group-name`, and the new child requirement as `requirement-name`.
282+
283+
Note that the process is the same for requirements or assertions; the only difference is
284+
the value of `type` in the entry's frontmatter
285+
(see [Fields for Requirements and Assertions](#requirements-and-assertions)).
286+
287+
1. Under the desired guideline's folder, create a Markdown file
288+
(e.g. `groups/group-name/guideline-name/requirement-name.md`)
289+
1. Edit the Markdown file for the guideline (e.g. `groups/group-name/guideline-name.md`)
290+
to add an entry in its `children` array for the new guideline
291+
- This is what makes the requirement/assertion appear in the document structure,
292+
and determines its order among the other entries under the same guideline
293+
- Arrays in frontmatter can be expressed similarly to Markdown lists, e.g.:
294+
```
295+
---
296+
children:
297+
- requirement-name
298+
---
299+
```
300+
301+
### New Term
302+
303+
Creating a glossary term is more straightforward, since there is no hierarchy:
304+
create a Markdown file under `terms`, then populate its content and any applicable
305+
[frontmatter](#terms).
306+
205307
## Environment Variables
206308
207309
### `WCAG_DIFFABLE`

0 commit comments

Comments
 (0)