Skip to content

add include option and resizing#25

Closed
Heiss wants to merge 1 commit into
gregzuro:masterfrom
Heiss:master
Closed

add include option and resizing#25
Heiss wants to merge 1 commit into
gregzuro:masterfrom
Heiss:master

Conversation

@Heiss
Copy link
Copy Markdown

@Heiss Heiss commented Feb 19, 2025

This PR enables to include files and make a small QoL improvement, so parsed images can be resized via leftclick on the image.

```structurizr
@from-file:workspace.dsl
```

The syntax is following the kroki-plugin for mkdocs and so it can be used with it to publish the vault e.g. digital garden and other stuff.

@gregzuro
Copy link
Copy Markdown
Owner

Thanks @Heiss — the @from_file: include feature is in 1.3.0 (#29, https://github.com/gregzuro/obsidian-kroki/releases/tag/1.3.0).

Small differences from the PR:

  • Path resolution uses getAbstractFileByPath + instanceof TFile rather than getFileByPath (the latter is 1.5.7+ and would have forced a minAppVersion bump). cachedRead is unchanged.
  • Missing file → an inline .kroki-error message in the rendered diagram rather than a silent console.log + broken render.
  • The switch from inline SVG to <img> isn't taken verbatim. Inline SVG (via DOMParser, not innerHTML) is kept on desktop so in-SVG <a xlink:href> links stay clickable (obsidian internal links not working for graphviz #9). On mobile (Platform.isMobile) and on any fetch/parse failure we fall back to <img src=krokiUrl> — which gives you the resizing benefit the PR was after and also fixes mobile (Diagrams don’t render on Obsidian mobile #8).

Sizing is handled by styles.css (max-width: 100%, height: auto) instead of inline attributes, so it cooperates with the user's theme. Closing — thanks for both ideas.

@gregzuro gregzuro closed this May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants