Skip to content
Discussion options

You must be logged in to vote

OK, instead of entering shadowland, where hyenas would be waiting for my poor lion cub self 🦁, I went with yet another approach.

By the time the HTML is rendered from Markdown, I have both the diagram contents, and the links for each node. So I just need to update the diagram code to add these links in the right place (in the click href). I use a regex replace. This is working fine 🙂

let diagram = document.getElementById('mermaid-diagram-{{ class.path }}');
diagram.innerHTML = diagram.innerHTML.replace(/click ([\w.]+) href ""/g, function(match, nodeID, offset) {
  let link = document.getElementById("mermaid-link-" + nodeID).href;
  return `click ${nodeID} href "${link}"`
});

I could not d…

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
7 replies
@pawamoy
Comment options

@pawamoy
Comment options

@pawamoy
Comment options

@kamilkrzyskow
Comment options

@pawamoy
Comment options

Comment options

You must be logged in to vote
3 replies
@kamilkrzyskow
Comment options

@kamilkrzyskow
Comment options

@pawamoy
Comment options

Answer selected by kamilkrzyskow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants