Skip to content

Commit d2fc291

Browse files
committed
fix: Better highlight infostring handling
1 parent 6d8782c commit d2fc291

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

text/3503-frontmatter.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -528,25 +528,31 @@ pprint([(k, v["title"]) for k, v in data.items()][:10])
528528
# Future possibilities
529529
[future-possibilities]: #future-possibilities
530530

531-
- Treat `cargo` as the default infostring
532-
- Since this is a one-way door, we want to make sure we are confident that that is the right default / policy
533-
- If there aren't guard rails (e.g. rustc enforcement) that no-infostring
534-
means `cargo`, it can easily be a free-for-all and we need to decide if we
535-
want that or if there is enough guard rails to discourage it.
536-
- Support more infostring languages
537-
- We need to better understand use cases for how this should be extended, particularly what the syntax should be
538-
- For reference, infostrings in commonmark (language + attributes) is just
539-
all non-backtick characters, supports `\` escapes, and entity / numeric
540-
character references with a vague notion of the language being the first "word"
541-
- A safe starting point could be to say that it must be an identifier
542-
- Hard coding it for now is much like how rustc has hard coded support for `#[rustdoc]` or `clippy`/`rustdoc` lint categories
543531
- Support infostring attributes
544532
- We need to better understand use cases for how this should be extended, particularly what the syntax should be (see infostring language)
545533
- A safe starting point could be to say that a space or comma separates attributes and everything after it is defined as part of the "language"
546534
- Loosen the code-fence syntax, like allowing newlines
547535
- Add support for a `#[frontmatter(info = "", content = "")]` attribute that this syntax maps to.
548536
- Since nothing will read this, whether we do it now or in the future will have no affect
549537

538+
## Optional or additional infostrings
539+
540+
We could support:
541+
- Treat `cargo` as the default infostring
542+
- Support more infostring languages
543+
544+
The question comes down to whether
545+
- rustc owns the definition of the infostring, allowing us to add additional types of metadata (rustfmt config, static analyzer config, etc)
546+
- This would be similar to our [hard coding of "tool" attributes](https://github.com/rust-lang/rust/issues/44690)
547+
- the shebang tool owns the definition of the infostring
548+
549+
By us hard coding `cargo` in the infostring in rustc,
550+
we are intentionally deferring the decision for which path we should go down.
551+
552+
We can add additional infostrings on a case-by-case basis.
553+
In doing so, we can learn more about the use cases involved which can help us
554+
get a better picture for which route we should go down.
555+
550556
## Multiple frontmatters
551557

552558
At least for cargo's use cases, the only other file that we would consider supporting is `Cargo.lock`

0 commit comments

Comments
 (0)