We'll update a graphviz tip using javascript scraped from a page and opened in a new ghost page. First some background. Then a solution.
Many algorithms represent graphs or trees. Use Graphviz to check that these structures are what you think they are. Examples in Ruby.
We create json for a page then write a click handler that will open that page in the lineup.
const dot = () => 'the quick brown fox jumped over the lazy dogs back' .split('') //.filter(c => c != ' ') .map((c,i,v) => `"${c}"->"${v[i+1]||'●'}";`) .join("\n")
function handler (event) { let message = { action: "showResult", page: { title:'Quick Brown Fox Graph', story:[{ type:'graphviz', text:`digraph { node [style=filled fillcolor=palegreen]; ${dot()}}`}]}, keepLineup: event.shiftKey } window.parent.postMessage(message, "*"); }
output.innerHTML = `<button>Open Graph</button>` output.addEventListener("click", handler)
http://js.ward.asia.wiki.org/assets/pages/snippet-template/basicjs.html?snippet-template HEIGHT 0