jeffreytse / jekyll-spaceship

🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, audio, youtube, vimeo, dailymotion, soundcloud, spotify, etc.
MIT License
606 stars 63 forks source link

interactive mermaid diagrams don't work #23

Closed ryepup closed 3 years ago

ryepup commented 3 years ago

Repro

Expected behavior

Clicking the "jekyll-spaceship" node in the rendered graph navigates to https://github.com/jeffreytse/jekyll-spaceship

Actual behavior

Nothing

Analysis

mermaid-processor.rb gets the SVG from mermaid and renders it in an <img> tag. That tag does not support interactivity.

If we render it with an <object> tag, then the interactive elements in SVG work.

I think the relevant spot to change is here: https://github.com/jeffreytse/jekyll-spaceship/blob/7d86dcbe03aabbde70d4b30d5d5b483754672632/lib/jekyll-spaceship/processors/mermaid-processor.rb#L76

ryepup commented 3 years ago

looks like <object> won't work; I can click the link but it tries to navigate inside the <object> body, which isn't right

ryepup commented 3 years ago

fixed with e1a5bf7 and using mode: 'pre-fetch'