beacon_live_admin icon indicating copy to clipboard operation
beacon_live_admin copied to clipboard

Editor: Extend markdown to support HEEx features

Open leandrocp opened this issue 1 year ago • 1 comments

Regular Markdown converter isn't capable of handling HEEx features. We want a subset of a regular Markdown that is capable of parsing and generating valid HEEx without losing features or breaking the compilation.

Function components

Beacon provides function components to display assets and will provide components for building pages, for eg:

<div>
  <BeaconWeb.Components.image name="my_image.png" />
</div>

Using such component should generate the expected HTML tags as it would in a HEEx template.

Navigation

A regular markdown link should probably generate the same markup as <.link navigate=..."> to include the phx-* attributes and allow it to transition pages efficiently, otherwise it triggers a redirect.

Research

MDX is a great solution for the JS ecosystem and we it can serve as inspiration to build something similar in Elixir.

The library md ~may be~ is capable of embedding heex but it doesn't support the CommonMark spec.

So a new library mdex was created to support what is needed for Beacon, but loading Phoenix Components is still a WIP.

leandrocp avatar Apr 19 '23 16:04 leandrocp

Relates to improving blog posts experience

AZholtkevych avatar Dec 04 '23 17:12 AZholtkevych