Skip to content

Commit ce78d92

Browse files
committed
fix(alt): Revamp prefix section
1 parent 6d8bf53 commit ce78d92

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

text/3503-frontmatter.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,14 @@ The hope would be that we could get buy-in from other languages.
309309
- Future evolution: Allow any `info` string with cargo checking for `content.starts_with(["cargo", "cargo,"])`
310310
- Future evolution: Allow `frontmatter` attribute on any module
311311

312-
If we dropped future possibilities for additional content, we could remove the opening/closing syntax and tweak it to avoid attribute ambiguity,
313-
greatly reducing the minimum syntax needed in some cases.
312+
Syntactically, this avoids confusion with attributes by being stripped before lexing.
313+
We could make this less ambiguous by using a double hash.
314314
````rust
315315
#!/usr/bin/env cargo
316-
## package.edition = "2018"
316+
## ```cargo
317+
## [dependencies]
318+
## foo = "1.2.3"
319+
## ```
317320

318321
fn main() {}
319322
````
@@ -326,11 +329,20 @@ Benefits
326329
- Maybe we can get others on board with this syntax
327330

328331
Downsides
332+
- `#` prefix plus a TOML `[heading]` looks too much like a Rust `#[attribute]`.
329333
- More syntactically heavy than the frontmatter solution
330334
- Visually
331-
- More work to type it out / copy-paste
335+
- More work to type it out or copy-paste between cargo scripts and regular manifests
332336
- More to get wrong
333-
- Requires users to deal with leading characters when editing/copying/pasting the manifest
337+
338+
If we dropped future possibilities for additional content, we could remove the opening/closing syntax,
339+
greatly reducing the minimum syntax needed in some cases.
340+
````rust
341+
#!/usr/bin/env cargo
342+
## package.edition = "2018"
343+
344+
fn main() {}
345+
````
334346

335347
### Alternative 3: Doc-comment
336348

0 commit comments

Comments
 (0)