upsiflu / matsite

2 stars 0 forks source link

Replace Templates & Hypertext with Blocks or elm-markdown #26

Open upsiflu opened 1 year ago

upsiflu commented 1 year ago

Current:

  1. Templates are written in elm/html, with access to a global Directory of valid routes
  2. There is a disabled mechanism to load HTML into custom elements
  3. Changes to the layout are stored in an append-only list for undo/redo and time travelling

Proposal:

  1. For each template, we create a BLOCK, which is a parametric type that renders to Html.
  2. One BLOCK is Hypertext, which simply renders arbitrary Html into a custom element
  3. Changes to the BLOCKs are stored in the global append-only list together with layout actions.

How to implement:

Each block is an Elm type. The view may introduce custom-elements, for example for rendering literal Html. An article's content is a list of blocks

It's easy to factor out the type module for a block into a standalone elm-element inside a custom-element as a block protocol block.

The current implementation can render to text :-)

Editor:

A block may have attributes. We can simply add an editor for attributes to the Control.

Scope:

Outlook:

upsiflu commented 1 year ago

Consideration: use elm-markdown as block description format.

Pro:

Con:

lmplementation:

(a) one md per block (b) one md per article, with custom html tags for blocks and helpful error messages

The editor can occupy a new region Source (toggle visibility on small screen; occupy leftmost screen column on wider viewport)

upsiflu commented 1 year ago

Concerning elm-markdown: Experiences gained when implementing github.com/upsiflu/multimedia