Skip to content

the highlight() function is not working as expect for nodes including ":" symbol #172

Open
@liijunwei

Description

@liijunwei

hi @tintinweb , really appreciated that you shared this plugin on vscode, it's been quite helpful for my daily work
especially the "bidirectional highlight" feature, makes upstreams and downstreams quite clear instantly

while using I found some unexpected behavior though, and I'd like to report and propose an quick fix to optimize the user experience 🙏

Minimal, Reproducible Example

digraph G {
  rankdir = LR;
  node [shape = note;];
  
  // bidirectional highlight works well
  z -> a;
  y -> a;
  a -> b -> d;
  b -> c -> e;
  a -> e;
  
  // bidirectional highlight works unexpected
  // e.g. click "c:d:e", "e:f:g" and "d:e:f" are not highlighted
  "a:b:c" -> "b:c:d";
  "b:c:d" -> "c:d:e";
  "c:d:e" -> "d:e:f";
  "c:d:e" -> "e:f:g";
  "g:h:i" -> "h:i:j";
  "h:i:j" -> "d:e:f";
  "h:i:j" -> "e:f:g";
  "c:d:e" -> "foo";
}

image

rough cause

it's using connection[0].split(":")[0]; and connection[1].split(":")[0]; in jquery.graphviz.svg.js

which implicitly depends on the format of node identifier

quick fix

removing .split(":")[0] from GraphvizSvg.prototype.linkedTo and GraphvizSvg.prototype.linkedFrom

later I checked out jquery.graphviz.svg.js source code and found the copy in source code is a bit outdated, if I copy the code here, everything works fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions