longform
longform copied to clipboard
Compile: Step Exceptions
(inspired by #37)
It would be very cool to be able to, for any given step in a compile workflow, choose one of three options:
- The step runs for all inputs of its type (the default, how things work right now).
- If a scene step, the step runs for only scenes in a given list.
- If a scene step, the runs for all scenes except those in a given list.
The tricky thing here, besides the actual UI, is where to store these exceptions. Workflow storage is at the plugin level, so project-specific data doesn't make sense there. It sounds like something that belongs in the index: perhaps a workflowExceptions key that is a map of step canonical IDs to lists of exception rules?
I fully agree that this is valuable. Especially the strip frontmatter step would need an option to keep the frontmatter for the very first scene.
The tricky thing here, besides the actual UI, is where to store these exceptions. Workflow storage is at the plugin level, so project-specific data doesn't make sense there. It sounds like something that belongs in the index: perhaps a workflowExceptions key that is a map of step canonical IDs to lists of exception rules?
Wouldn't a yaml-key in the yaml of the respective scenes work for this, something like this? (of course that yaml info must be saved before the compile, the strip frontmatter step will conflict with this 😆 )
---
compile-ignore: step-name
---
---
compile-include: step-name
---
I actually considered the frontmatter approach and forgot to add it here! I like it, especially because this seems like an edge vase for most people. And since steps get metadata from the obsidian cache, stripping via step shouldn't affect this, but it needs testing...
Worth mentioning that I've also thought about another step to handle your use case: inserting frontmatter directly into a manuscript, perhaps by merging it from another file.
Love the new workflow steps! One question: would it be possible to have a sort of exception to removing the frontmatter, so this excludes other uses of the triple hyphen "---"? I sometimes use them to separate paragraphs or something like that and I noticed that if they're close to the beginning of a note that whole paragraph gets removed along with the frontmatter.
Maybe (and I have no idea what I'm talking about) it would be possible to differentiate between valid YAML and just regular text? Thanks :)
Oh that's a bug: the regex must not be tight enough. Can you post a contrived example to help me fix it?
Yeah sure, thanks for the quick reply :):
---
status: ok
tags: manuscript
---
# Introduction
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean consectetur ullamcorper sagittis. Phasellus consectetur ac odio nec egestas. Praesent facilisis nisl augue, non dignissim neque fermentum in. Aliquam ut rutrum turpis. Cras et est at ligula elementum lacinia vel in orci. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus pretium egestas urna, ac accumsan metus feugiat quis.
---
The first bit is the actual frontmatter, then comes the headline for the note, then a quote that is relevant to the note and then another triple hyphen to separate the quote from the actual text. The whole thing disappears in the process of compiling. Thanks :)