Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Expose sections as documents (VDOM) #143

Closed
kptdobe opened this issue Dec 19, 2018 · 7 comments
Closed

Expose sections as documents (VDOM) #143

kptdobe opened this issue Dec 19, 2018 · 7 comments
Labels
enhancement New feature or request

Comments

@kptdobe
Copy link
Contributor

kptdobe commented Dec 19, 2018

During the hackathon, I "played" with sections and the first thing I always do is transforming the sections into documents (VDOM) where the API is must front-end developer oriented than MDAST... See https://github.com/kptdobe/helix-sections-playground/blob/master/src/html.pre.js#L37-L38.

Manipulation, inserting nodes... everything is more simple and in the pre.js, I think a developer would rather care about the DOM than the data structure when consuming sections.

I propose that the pipeline takes care of the transformation.

@trieloff WDYT ?

@kptdobe
Copy link
Contributor Author

kptdobe commented Dec 19, 2018

Well... +/- the types!
Maybe the sections should be an object like:
{
"index": "index of the section in the list",
"types": ["list of computed types"],
"document": {VDOM document object}
}

@trieloff
Copy link
Contributor

I think just adding a document node to each section would do no harm and still grant full access to the MDAST.

@koraa koraa self-assigned this Feb 14, 2019
@koraa koraa removed their assignment Mar 11, 2019
@kptdobe kptdobe changed the title Expose sections as documents (VDOM) and not MDAST Expose sections as documents (VDOM) Mar 26, 2019
@kptdobe kptdobe added enhancement New feature or request good first issue Good for newcomers labels Mar 26, 2019
@kptdobe
Copy link
Contributor Author

kptdobe commented Apr 24, 2019

With #279, <sections> tags will be added to the content.document object (and <hr> removed). This will give a VDOM API access on the sections. 2 options now:

  1. we do not need this enhancement
  2. the idea of a document property on each section could be recycled into a reference to the section node inside the content.document

@trieloff
Copy link
Contributor

we do not need this enhancement

And in addition, I think we will at some point deprecate content.sections.

@kptdobe
Copy link
Contributor Author

kptdobe commented Apr 24, 2019

Then we need to think where do we put the mast, index and types properties. Maybe as data in the VDOM object ?

@trieloff
Copy link
Contributor

Good point & good idea.

@kptdobe kptdobe removed the good first issue Good for newcomers label Apr 25, 2019
@ramboz
Copy link
Contributor

ramboz commented Jul 12, 2019

This has now been tackled in #379 and is in v4.0.0
@kptdobe, @trieloff Would it be safe to close the issue? or do you still see remaining points that aren't covered

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants