Environment information
(This is a repost of my comment from #3334. @dyc3 asked me to repost it as a standalone Issue.)
I just noticed the following in an HTML file Iām working on in VSCodium:
The thing is⦠the statement that frontmatter is āonly valid inside Astro filesā is false.
Back in the early 2010s, I was using the excellent Metalsmith static site generator to build websites, and it heavily featured frontmatter as a flexible tool for a āroll your ownāĀ config/workflow/whatever.
These days, I use Eleventy, but it also features frontmatter as an incredibly flexible, useful tool for developers who like the freedom that frontmatter provides.
Please donāt treat frontmatter as an Astro-specific feature.
- Ideally, offer opt-in support for it at a general- or language-specific level.
- (Less-than-ideally, at least update the parserās message to say something like āBiome currently only supports frontmatter in Astro filesā.)
@dyc3 Asked me to explain my use case. The use case for frontmatter is always the same. This is true whether it is in an *.astro file, a markdown file, or any other file.
Here is an excerpt from this article that succinctly explain:
As with many new tech terms, the term front matter is borrowed from another domain; books. In the literary world, front matter refers to the information found in the first pages of a book. [ ⦠ABRIDGED ⦠] Front matter in literary terms is the collection of information stored at the beginning of books that explains what the book is and how it was produced. For programming front matter refers to the section of a markdown file that gives context to the content of the file (though the concept is not specific to markdown and can be applied to other file types including yaml, toml and json as well).
This data allows us to do a wide range of actions with the file including creating dynamic routing for where the composed template is placed, access a title and cover photo, create preview cards and even sort collections based on creation dates.
Front matter allows us to access all of the context of a file, without having to rely solely on file attributes or parsing the file itself. Because front matter has special syntax to separate it from the content of the markdown file, we never need to worry about incorrectly parsing it.
What happened?
- I opened an HTML file with some frontmatter in VSCodium (with biome 2.4.14).
- I got a parser error that āfrontmatter is only valid inside Astro filesā (see above image).
Expected result
Frontmatter is valid in all sorts of files, not just *.astro.
I think Biome should:
- (Ideally) Offer opt-in support for it at a general- or language-specific level. OR,
- (Less-than-ideally) At least update the parserās message to say something like āBiome currently only supports frontmatter in Astro filesā.
Code of Conduct
Environment information
(This is a repost of my comment from #3334. @dyc3 asked me to repost it as a standalone Issue.)
I just noticed the following in an HTML file Iām working on in VSCodium:
The thing is⦠the statement that frontmatter is āonly valid inside Astro filesā is false.
Back in the early 2010s, I was using the excellent Metalsmith static site generator to build websites, and it heavily featured frontmatter as a flexible tool for a āroll your ownāĀ config/workflow/whatever.
These days, I use Eleventy, but it also features frontmatter as an incredibly flexible, useful tool for developers who like the freedom that frontmatter provides.
Please donāt treat frontmatter as an Astro-specific feature.
@dyc3 Asked me to explain my use case. The use case for frontmatter is always the same. This is true whether it is in an
*.astrofile, a markdown file, or any other file.Here is an excerpt from this article that succinctly explain:
What happened?
Expected result
Frontmatter is valid in all sorts of files, not just
*.astro.I think Biome should:
Code of Conduct