Hrule delimited sections for slides. #230
Unanswered
DougInAMug
asked this question in
Q&A
Replies: 1 comment 1 reply
|
function rehypeSections() {
return (tree) => {
const groups = [[]]
for (const n of tree.children) {
if (n.type === 'element' && n.tagName === 'hr') groups.push([])
else groups[groups.length - 1].push(n)
}
tree.children = groups
.filter((g) => g.some((n) => n.type !== 'text' || n.value.trim()))
.map((children) => ({type: 'element', tagName: 'section', properties: {}, children}))
}
}Ran it through One gotcha: a plain text line right above |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Several markdown-to-slides frameworks interpret the markdown hrule
---as a delimiter for slides. Until now I was using the confusingly named remarkjs which wraps nodes between hrules in a div. It is possible to use CSS scroll snap to provide slide-like transitions without JS. I am looking for pointers on the easiest/best way to convert markdown to html with this adaption. For example, from:... to:
All reactions