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

Inject frontmatter properties of a section as DOM properties #355

Closed
kptdobe opened this issue Jun 4, 2019 · 3 comments
Closed

Inject frontmatter properties of a section as DOM properties #355

kptdobe opened this issue Jun 4, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@kptdobe
Copy link
Contributor

kptdobe commented Jun 4, 2019

Once #279 is done, sections will be included by default inside a wrapping element (div or section, being discussed). Leveraging the frontmatter properties of each section and injecting them as DOM properties would be an easy way for a developer to give some styling freedom but also directive to control the section rendering to content authors.

Example:

---
class: my-custom-section-class
data-some-custom-data: my-value
---
section content

would lead to a wrapping DOM element:

<div class="section my-custom-section-class" data-some-custom-data="my-value"><p>section content</p></div>

cc @davidnuescheler

@trieloff trieloff added the enhancement New feature or request label Jun 6, 2019
@ramboz
Copy link
Contributor

ramboz commented Jun 10, 2019

I'd also propose to let the author specify the tag to be used:

tag: my-tag
class: my-custom-section-class
data-some-custom-data: my-value

to get:

<my-tag class="section my-custom-section-class" data-some-custom-data="my-value"> 
    <p>section content</p>
</my-tag>

The idea is really just to be able to better control semantics and SEO.

The tag would default to whatever the outcome of #279 is (i.e. section or div).

@davidnuescheler
Copy link
Contributor

looking through the PR i think we have gone a little bit beyond the above example provided by @ramboz

i really liked what's outlined and i think as we start thinking of the DOM as becoming the more central payload for the pipeline, i think it is desirable to pass information that we want to use throughout processing along as attributes (or tags) in the DOM, even if they get removed in a final step before the markup is generated.

in that light i think that we could allow non-standard attributes and tags throughout the pipeline as we give the developer the ability to enforce strict compliance at the end of the pipeline if they want to.

@ramboz
Copy link
Contributor

ramboz commented Jul 12, 2019

Should be mostly covered by #379 now and in since v4.0.0
@kptdobe Safe to close?

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