This is an extension of #516 and depends on #533
So far, helix-markup.yaml is capable of matching DOM elements and lower-level MDAST structures, but when it comes to sections, the features provided by #533 include only the ability to:
- control which of the inferred types from
content.section[].types should show up in the section tag's class attribute
- control if a
section should be rendered as a div (default), section, nav, main, header, footer, or any other HTML element
With this extension, developers will furthermore be able to:
- control which types are inferred without using
utils.types imperatively
- infer section types based on URL patterns
For this, helix-markup.yaml will get a new optional key, sections:
sections:
navigation:
content: ^heading? list+$
uri: /nav.html
markup:
navigation:
match: section[@type=navigation]
type: markdown
wrap: nav
In the example above, if a URL matching /nav.html (we support URI Template expressions) is requested, and there is a section containing one optional heading at the beginning and a series of lists, then that section should get a type with the value navigation (in addition to the automatically inferred types).
In the second part of the example, sections in MDAST with a type that contains navigation are getting wrapped in nav elements.
/cc @davidnuescheler
This is an extension of #516 and depends on #533
So far,
helix-markup.yamlis capable of matching DOM elements and lower-level MDAST structures, but when it comes to sections, the features provided by #533 include only the ability to:content.section[].typesshould show up in thesectiontag'sclassattributesectionshould be rendered as adiv(default),section,nav,main,header,footer, or any other HTML elementWith this extension, developers will furthermore be able to:
utils.typesimperativelyFor this,
helix-markup.yamlwill get a new optional key,sections:In the example above, if a URL matching
/nav.html(we support URI Template expressions) is requested, and there is a section containing one optionalheadingat the beginning and a series oflists, then that section should get atypewith the valuenavigation(in addition to the automatically inferred types).In the second part of the example,
sections in MDAST with atypethat containsnavigationare getting wrapped innavelements./cc @davidnuescheler