Closed nielsbom closed 1 year ago
Easy: make the frontmatter a script element similar to the "js" type that returns an object. HTML everywhere.
Formatting .webc
files as Markdown instead of HTML seems to work in VS Code. Frontmatter is left intact on format, and Markdown supports HTML.
Moving this to eleventy-plugin-webc, front matter is a Eleventy-specific feature and not internal to the WebC file format.
Can you elaborate more specifically on which HTML formatting tools you’re referring to?
VS Code’s “Format Document” feature on a WebC file with front matter works fine, in a simple test.
The most straightforward solution here if you’re dealing with formatting issues is to use Template data files instead of front matter: https://www.11ty.dev/docs/data-template-dir/
@riskygit
Easy: make the frontmatter a script element similar to the "js" type that returns an object. HTML everywhere.
I don't understand what you mean, can you please elaborate?
@studiochris
Formatting .webc files as Markdown instead of HTML seems to work in VS Code. Frontmatter is left intact on format, and Markdown supports HTML.
When I set the language mode for a .webc
file to Markdown VS Code (correctly) does not mess up the frontmatter. But it then also stops formatting the HTML below the frontmatter and other features like Auto Closing Tags
also stop working. Not a solution I'm that happy with.
@zachleat
VS Code’s “Format Document” feature on a WebC file with front matter works fine, in a simple test.
I tested some more and I discovered I'm (or rather was) using this deprecated formatter extension.
Sorry for sorta crying wolf. Thanks for the help y'all!
@zachleat
The most straightforward solution here if you’re dealing with formatting issues is to use Template data files instead of front matter: https://www.11ty.dev/docs/data-template-dir/
Would that work for layout files tho?
So
.webc
files are HTML. So we can use HTML syntax highlighting and formatting for it. But we can also use them to hold site content, what Eleventy calls "templates". A template can also hold frontmatter like so:An HTML formatter will mangle this so the frontmatter is incorrect.
I'm thinking a couple of things:
.webc
file and the HTML part. I don't think that's gonna happen any time soon..webc
files in certain directories and not others? I'm not sure if that's possible straight from an editor, in VS Code it doesn't look like it..webc
files, so in other words: don't use them for the content of a site. Instead use Markdown for example.So my question is: what is a/your practical solution for this?