static-cms
static-cms copied to clipboard
Custom Formatter
Is there a way to load a file of type other than the ones supported by format
?
I'm working on a custom widget and trying to load a .tsx
file (to later serialize with TS api and consume as AST), but the issue is that I cannot find a proper formatter for such use case. I can use frontmatter
and set the field name to body
, but then when using a nested collection it starts complaining about a missing title (which makes sense, since the formatter is not the proper one).
I had the same issue when working with .json
files, since the json formatter returns a field, not the full json content.
If it's not supported currently, does it make sense to add support for registering custom formats? or maybe introducing a new formatter that treats the file content as body and doesn't attempt to parse or serialize?
At current I am not planning on expanding the available file formats, and custom formats are not yet supported.
Adding the ability to provider a custom formatter would be doable. I'll keep this in the backlog for the future.