Closed nikku closed 8 years ago
I hoped we can circumvent the addition of yet another property by rendering the combined page once with nunjucks and processing+replacing only the markdown-part in a second step.
This way, the macro could be defined as part of the layouting template.
Performing markdown processing as a post-step sounds like a good solution.
This would circumvent the fact that the Markdown parser interprets nunjucks templates and messes up with them before they are evaluated.
This would circumvent the fact that the Markdown parser interprets nunjucks templates and messes up with them before they are evaluated.
That seems already not possible as nunjucks processes in step 1.0 and markdown in 1.1.
Anyway, I would process step 1.0 or 1.2 as necessary (layout
property given or not) and somehow mark the content (e.g. <page-content>...</page-content>
). Next, I'd extract this content, process it with markdown, and add it back without this marker to the result.
That's what I ment.
This would circumvent the fact that the Markdown parser interprets nunjucks templates and messes up with them before they are evaluated.
In other words: The only reason why we currently have to process the page via Nunjucks twice is the fact that Markdown generation will mess up the templating otherwise.
Can you prepare a PR on this? I am happy to ditch the include
feature in place of something more convenient.
I will give it a try in the evening(s).
Should I keep the include feature? Maybe no layout is desired after all?
I would ditch it. It is always possible to include a noop layout.
Why current step 1.2 is only required if markdown processing is necessary?
Uiui... you're tests fail on Windows due to line ending issues.
An additional change (5b8b77e557e882a13d460067dbcb57c22b6f11a0) was needed to make the macro changes usable in real world scenarios.
It should be possible to evaluate certain template fragments in the scope of a Markdown document.
With this functionality users are able to provide boilerplate code via macros.
Page
Macro