Skip to content

Commit e97aac0

Browse files
committed
Clarify frontmatter position rule
The `frontmatter.document` rule said "Frontmatter may only be preceded by a shebang and whitespace", where the "and" could be misread as requiring both a shebang and whitespace rather than listing the set of things allowed to precede frontmatter. Since we merged the shebang prose revision (#2192), the shebang position rule now reads as a positive statement of where the shebang may appear. Let's follow the same pattern here: state positively where frontmatter may appear rather than leaning on "only" and a negative constraint. We'll also rename the rule identifier to `frontmatter.position` in keeping with our conventions.
1 parent b4c5ec3 commit e97aac0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/frontmatter.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ fn main() {
5050
}
5151
```
5252

53-
r[frontmatter.document]
54-
Frontmatter may only be preceded by a [shebang] and [whitespace].
53+
r[frontmatter.position]
54+
Frontmatter may appear at the start of the file (after the optional [byte order mark]) or after a [shebang]. In either case, it may be preceded by [whitespace].
5555

5656
r[frontmatter.fence]
5757
Frontmatter must start and end with a *fence*. Each fence must start at the beginning of a line. The opening fence must consist of at least 3 and no more than 255 hyphens (`-`). The closing fence must have exactly the same number of hyphens as the opening fence. The hyphens of either fence may be followed by [horizontal whitespace].
@@ -62,6 +62,7 @@ The opening fence, after optional [horizontal whitespace], may be followed by an
6262
r[frontmatter.body]
6363
No line in the body may start with a sequence of hyphens (`-`) equal to or longer than the opening fence. The body may not contain carriage returns.
6464

65+
[byte order mark]: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8
6566
[horizontal whitespace]: grammar-HORIZONTAL_WHITESPACE
6667
[shebang]: input-format.md#shebang-removal
6768
[whitespace]: whitespace.md

0 commit comments

Comments
 (0)