danieleades / mdbook-d2

D2 diagram generator plugin for MdBook
MIT License
20 stars 7 forks source link

Ability to load files in addition to inline code blocks #35

Closed blaggacao closed 2 days ago

blaggacao commented 1 year ago

There are good examples from the mdbook-kroki preprocessor. It would be convenient to copycat that functionality.

In medias res references:

danieleades commented 1 year ago

I like that approach. It does beg the question of why you shouldn't just use the kroki preprocessor (which supports D2), no?

blaggacao commented 1 year ago

just use the kroki preprocessor (which supports D2), no?

The public (free) service has a limitation on payload length that quickly becomes a blocker on architecture diagrams.

Additionally, should there be sensitive information in the diagrams it may be against applicable policy to send them to a remote service.

danieleades commented 1 year ago

just use the kroki preprocessor (which supports D2), no?

The public (free) service has a limitation on payload length that quickly becomes a blocker on architecture diagrams.

Additionally, should there be sensitive information in the diagrams it may be against applicable policy to send them to a remote service.

You can run a local kroki instance without too much difficulty, but I take your point.

I'll take a deeper look at kroki's approach. I wouldn't want to implement anything that's going to break syntax highlighting plugins.

PRs welcome!

christianjann commented 3 days ago

I used the import feature of d2: https://d2lang.com/tour/imports/, e.g. to load a complete diagram:

```d2
...@my_folder/mydiagram

Also importing parts of a diagram works.
danieleades commented 2 days ago

i take it then that this is already supported by D2 with no need to implement in this plugin?

closing.