Closed sb8244 closed 3 years ago
I implemented the RichText to HTML API from the TypeScript library into Elixir. I believe that all of the same options are available, with only a few changes needed due to Elixir being functional.
https://github.com/cloveapp/community-contentful-html-renderer-elixir
I have not finalized it yet, but you can see the implementation details at https://github.com/cloveapp/community-contentful-html-renderer-elixir/blob/main/test/contentful_renderer/html_test.exs
I think it's a good idea to have something like that readily available as an Elixir implementation, but I'd not put it into the context of this particular library myself. I'd rather provide an interface here that the renderer would be able to ingest.
Totally agree. I'm taking the output of this and using it in the renderer already, so no changes needed.
I made a few changes to the library to get it to be usable for myself, but I wasn't planning on submitting those as I'm not sure they align with what you'd want for the library. But you can see the diff at https://github.com/contentful-labs/contentful.ex/compare/master...cloveapp:master if you're curious.
The biggest thing I hit was needing filters that are available in the API but not available in the library. I added the override concept for simplicity sake (versus adding Elixir API for them)
This is a bit of a stretch, but I'm wondering if there have been thoughts of RichText to HTML API? I'd like to avoid storing the JSON format and converting on the client.
One option is to utilize the Node.js library with a shell call, but keeping it native would be amazing.
I'm not opposed to building a native Elixir implementation, as it doesn't look like an excessively difficult format to work with. I just wanted to check to see if this has been thought about at all!