Enhance Realm Rendering in Gno by Supporting Multiple Render Methods #1422
Labels
📦 ⛰️ gno.land
Issues or PRs gno.land package related
📦 🤖 gnovm
Issues or PRs gnovm related
🧾 package/realm
Tag used for new Realms or Packages.
🌟 improvement
performance improvements, refactors ...
In the current implementation, each realm possesses a
Render
method that returns a Markdown representation of the realm. While there are ongoing efforts to enhance this default rendering format (as discussed in issue #439), the current method is limited in scope, supporting only this single, default rendering format.To extend the versatility and usability of realms, I propose introducing additional rendering methods. This enhancement would allow realms to support various formats like HTML, JSON, etc., akin to how structures in Go can implement custom
MarshalJSON
andUnmarshalJSON
methods for JSON processing.Implementation
RenderHTML
,RenderJSON
,RenderXXX
, etc. This approach enables platforms, devices, or any other clients to request a specific render format as per their requirements. These methods could coexist with the existingRender
method, providing developers with a suite of flexible rendering options.Render
method. This method would act as a fallback, guaranteeing that a basic and human readable Markdown rendering is always available, regardless of the additional formats supported.This proposal, while introducing versatile rendering options like
RenderHTML
orRenderJSON
complements the ongoing improvements to the defaultRender
method discussed in issue #439. It aims to broaden the utility and adaptability of Gno realms without conflicting with existing enhancement efforts. By offering diverse rendering capabilities alongside a reliable Markdown fallback, this enhancement seeks to cater to a wider range of use cases, from web views to specific data representation.The text was updated successfully, but these errors were encountered: