Literate.jl
Literate.jl copied to clipboard
FR: Supporting flavor-specific filtering
Existing:
At the moment, you can include/exclude lines based on type, eg, Markdown, Notebook, script.
Example: a=1 #md will only be included in the Markdown outputs
Request:
It would be valuable to be able to filter out certain lines based on flavors of these types.
Wish: a=1 #mdq will only be included in QuartoFlavor Markdown outputs but no other Markdown
Where:
- #md defines the type (no breaking change)
- suffix q/c/d etc. would represent the respective flavors
Same for exclusion command.
Possible implementation:
- Refactor the following if-conditions to produce the right regex for each type&flavour combination
- For a given type+flavor, let's say Markdown + QuartoFlavor (code "mdq"), you would filter out any lines with a different type (!nb, !jl of any flavor) and you would filter out all "!md " or "!md
" - With such logic, you don't need to know all flavors / produce conditions for all flavors, you simply include/filter based on the selected flavor
I'm happy to open the PR if there is an interest.
Benefits:
- It would possibly help with the support of multiple types of notebooks (eg, #120 ) and markdowns (eg, #199 )
- For example, Quarto requires specific YAML headers at the top, which look incredibly ugly when a normal Markdown is produced