taplo icon indicating copy to clipboard operation
taplo copied to clipboard

Formatting TOML frontmatter in a markdown file

Open hydrajump opened this issue 1 year ago • 2 comments

This extension is great because it provides syntax highlighting for TOML frontmatter commonly used by the Hugo static site generator. Example of frontmatter in a markdown file:

+++
date = 2024-01-13
   some_text = "hello there"
some_value = 2
some_array = ["a", "b","c"]
+++

Here's the markdown content

What I'd love to be able to do is use this VS Code extension to format the frontmatter. At the moment the extension doesn't provide a way to format unless the TOML frontmatter is first copied into a new file and saved with the .toml extension.

Not sure what's needed to make this work 😊

hydrajump avatar Jan 13 '24 16:01 hydrajump

I'm also not sure what it would need to work, but most probably a considerable amount of work that the project can't provide right now. Ideally Taplo would need to work on ranges in a file. I'm not sure schemastore supports this, so it would also need some manual work on the schema side too.

Adding appropriate labels in case someone wants to take on this. But I'm not even sure I would be able to review such large PR.

ia0 avatar Jan 13 '24 21:01 ia0

Note that this was supported in the deprecated "better toml" https://github.com/bungcip/better-toml/pull/11

JasperVanDenBosch avatar Apr 11 '24 15:04 JasperVanDenBosch