BeaconCMS / beacon_live_admin

Phoenix LiveView Admin Panel to manage Beacon CMS sites.
https://beaconcms.org
MIT License
55 stars 22 forks source link

Editor: Extend markdown to support HEEx features #28

Open leandrocp opened 1 year ago

leandrocp commented 1 year ago

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.

AZholtkevych commented 11 months ago

Relates to improving blog posts experience