Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[community]: Render documents to graphviz #24830

Merged
Prev Previous commit
Next Next commit
escape
  • Loading branch information
bjchambers committed Sep 24, 2024
commit 9598ea425bf055dc8f5aa3feb9461e3f88105b82
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ def render_graphviz(
color = node_colors.get(id) or node_color
graph.node(
escaped_id,
label=f"{id}",
label=graphviz.escape(id),
shape="note",
fillcolor=color,
tooltip=document.page_content,
tooltip=graphviz.escape(document.page_content),
)

for link in get_links(document):
tag = f"{link.kind}_{link.tag}"
if tag not in tags:
graph.node(tag, label=f"{link.kind}:{link.tag}")
graph.node(tag, label=graphviz.escape(f"{link.kind}:{link.tag}"))
tags.add(tag)

graph.edge(escaped_id, tag, dir=_EDGE_DIRECTION[link.direction])
Expand Down