Nested blocks inside a directive
ahopkins opened this issue · comments
Adam Hopkins commented
Are nested directives supported? I am trying to create a custom directive to add some columns. But, I would like to also have other directives and block level items. It seems that only inline parsing is happening inside of the directive. Is there something that I need to enable? Is this supported?
Adam Hopkins commented
Figured it out.
class Column(DirectivePlugin):
def parse(
self, block: BlockParser, m: Match, state: BlockState
) -> dict[str, Any]:
info = m.groupdict()
new_state = block.state_cls()
new_state.process(dedent(info["text"]))
block.parse(new_state)
return {
...,
"children": new_state.tokens,
}
Hsiaoming Yang commented
@ahopkins Hi, if you have already fixed it, I'll close this issue. If not, please reopen it.
Adam Hopkins commented
All good, thanks.