tag:support.markedapp.com,2011-09-11:/discussions/problems/155948-preprocessing-transcluded-filesMarked: Discussion 2019-12-02T14:33:05Ztag:support.markedapp.com,2011-09-11:Comment/478592442019-11-21T19:43:18Z2019-11-21T19:43:21ZPreprocessing transcluded files<div><p>Hi there,</p>
<p>I have begun experimenting with using the various kinds of transclude syntax for previewing larger projects made up of multiple files together. I also use a custom preprocessor. So far I have found that only the main file is processed, but I'd like the preprocessor to apply to everything previewed, including the transcluded files. Is that possible, or is it simply not possible to use a preprocessor in this way? And if it is possible, what might I be doing wrong? Any help much appreciated.</p>
<p>Thanks in advance!</p>
<p>Mark</p></div>Mark Knighttag:support.markedapp.com,2011-09-11:Comment/478592442019-11-21T19:50:19Z2019-11-21T19:50:19ZPreprocessing transcluded files<div><p>The entire concatenated file should be processed, but there's no<br>
individual processing for included files. Does that answer your<br>
question? If not, could you give me some more details on exactly how<br>
you're including files and what your preprocessor setup is?</p>
<p>Thanks,<br>
Brett</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/478592442019-11-21T20:28:32Z2019-11-21T20:28:33ZPreprocessing transcluded files<div><p>Hi Brett,</p>
<p>Thanks for a speedy response. In light of your answer, I can now see I hadn’t quite tested enough to realise what was happening.</p>
<p>You’re right, of course, that when I include a file using the standard syntax (e.g. <<[Testing 321.txt]) everything is processed.</p>
<p>I use a simple preprocessor to do one or two things to notes in nvALT, like turning [[Links]] into Markdown links that will still link back to those original notes in previews, etc. (You actually helped me with the regex for that one moons ago – thanks again!)</p>
<p>What I want to achieve is to have functional [[Links]] to the files in nvALT (or ULTRA!) that would turn into includes in the preview. To do that, I’ve attempted using a regex in a preprocessor that will take any [[Link]] followed directly by a symbol (◇) and turn it into the include syntax – thus, instead of being turned into a Markdown link by the preprocessor, it gets turned into an include.</p>
<p>All that is working fine, but for the fact that the file included is not then processed by the preprocessor as it would be if the include syntax actually appeared in the main file rather than being “created” as it were at this stage.</p>
<p>Perhaps this is just a really stupid thing to attempt! But I’ve been working on the basis of something that would be very useful for me. Is it just impossible?</p>
<p>Thanks!</p>
<p>Mark</p></div>Mark Knighttag:support.markedapp.com,2011-09-11:Comment/478592442019-11-21T21:57:42Z2019-11-21T21:57:42ZPreprocessing transcluded files<div><p>Well, preprocessing every individual file is very complicated from<br>
Marked's perspective, so I doubt anything will change there. And you're<br>
right, by the time Marked runs the preprocessor, it's already checked<br>
for includes and won't process new ones.</p>
<p>You do have the option, of course, of inserting the text yourself. If<br>
you're already doing a search and replace, you should be able to <code>cat</code><br>
the actual note into place. It would still get all of the regular<br>
processing, but if you needed to preprocess the included note as well<br>
then things get a step more complicated. But just inserting the text of<br>
files you have a path for shouldn't be impossible.</p>
<p>BTW, in nvUltra the MMD transclusion syntax works in the preview<br>
automatically :).</p>
<p>-Brett</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/478592442019-12-02T14:33:04Z2019-12-02T14:33:05ZPreprocessing transcluded files<div><p>Belatedly, thanks, and good to know the transclusion will work with nvUltra! Mark</p></div>Mark Knight