It would be neat to have a way to easily prepend lines of code to D2 code blocks, either in the global config or presentation wide.
For example, if I'd like sketch mode and transparent fill for all my D2 diagrams, I'd need to add this to the start of every D2 block, which gets pretty repetitive.
vars: { d2-config: { sketch: true } }
style.fill: transparent
Actually, maybe this feature could be helpful for any other code blocks in other languages as well, like import statements for example?
I suggest the following for UX:
Global config
prepend:
d2: |
vars: { d2-config: { sketch: true } }
style.fill: transparent
Presentation front matter
---
title: D2
author: shanscendent
prepend:
d2: |
vars: { d2-config: { sketch: true } }
style.fill: transparent
---
It would be neat to have a way to easily prepend lines of code to D2 code blocks, either in the global config or presentation wide.
For example, if I'd like sketch mode and transparent fill for all my D2 diagrams, I'd need to add this to the start of every D2 block, which gets pretty repetitive.
Actually, maybe this feature could be helpful for any other code blocks in other languages as well, like import statements for example?
I suggest the following for UX:
Global config
Presentation front matter