Variable Substitution does not work when chaining documents
Hello @manuth
Running the Chain all Documents command the variables are not set.
Whether referring to them in the same md file they were defined or another file. Nothing is rendered. However if a varible is set as a header, e.g. ## {{ Title }} then it is rendered Untitled-1.
Thx
Hi @karmeye I feel like this will bring up a lot of questions I haven't considered or thought about so far.
Currently, MarkdownConverter creates a blank document and pastes the content of all markdown files it can find into said document. After that, it will convert the document mentioned before.
This document is not saved to the disk which is why you end up with the Title being Untitled-1. In this process, all yaml variables are basically getting thrown away.
I'm not sure on how to go on further with this. I have some questions in mind I need to think about before being able to implement some alternative which is why I haven't assigned this issue to the upcoming milestone.
The questions being:
puppeteerdoesn't allow dynamic headers and footers which means: The headers and footers in the whole chained document must be the same.- Where should the variables for the header and the footer be loaded from?
- Should the variables from all documents be merged together?
- How should
MarkdownConverterhandle the case when multiple documents declare variables with the same name?
- An option would be to first convert all markdown files to HTML and chain the HTML code together. To make sure no variables get substituted by accident, #143 must be implemented first.
- Another option would be to create a separate method for only rendering the markdown segment using handlebars but not using
markdown-it... no idea how to name it though. However - just like in the method mentioned before, the resulting markdown code could be chained together. This might work out the best, I guess.