Man, I should have started Conductor with filters
I added a few more (obvious) filters to Conductor this morning. I really should have started here, it makes configuration so convenient and alleviates the need for about 50% of what you would do with scripting. Now you can do it all from one YAML file.
The new filters are:
insertTOC(max, after) |
insert TOC (max=max levels, after=start, *h1, or h2) |
prepend/appendFile(path) |
insert a file as Markdown at beginning or end of content |
prepend/appendRaw(path) |
insert a file as raw HTML at beginning or end of content |
prepend/appendCode(path) |
insert a file as a code block at beginning or end of content |
These allow you to insert a table of contents and append or prepend files, raw HTML, or code blocks.
Inserted files can be absolute paths or you can store templates in ~/.config/conductor/files
and just reference them by filename. Perfect for adding things like bios and disclaimers to your documents before outputing them (as PDF, HTML, or even as a new Markdown document).
The table of contents can be inserted at the top (“start” or “top”) or after the first h1 or h2 in the document.
If you use insertTOC(3, h1)
after an insertTitle
in a sequence
, you’d get a title inserted from metadata first, then a TOC inserted after it. (Then use the new insertScript()
filter to add Mermaid or a custom MathJax implementation. Sky’s the limit, kind of.)
These filters make some of the more basic tasks you’d usually perform with a Custom Processor script as easy as one line in a config file.
Full details on the project page.