Leaves need to end with [N] in order to have the Notes attached
All checks were successful
Updates the graph by copying the updated files in the right directory / build-and-deploy (push) Successful in 13s

This commit is contained in:
CawaAlreadyTaken 2025-11-16 10:34:05 +01:00
parent d4e53a519b
commit 01a3f0bde5
2 changed files with 10 additions and 12 deletions

View file

@ -102,22 +102,19 @@ function update(source) {
})
.style("fill-opacity", 1e-6);
// Add Notes link for leaf nodes only
// Add Notes link for leaf nodes whose name ends with [N]
nodeEnter
.filter(function (d) {
return !d.children && !d._children;
// foglia + nome che termina con [N]
return !d.children && !d._children && /\[N\]$/.test(d.name);
})
.append("a")
.attr("target", "_blank")
.attr("xlink:href", (d) => "viewer.html?file=notes/" + d.name + ".md")
.attr("target", "_blank") // ← open in new tab
/* .attr("xlink:href", function (d) {
return (
"https://git.hackinpovo.it/HackInPovo/resources/raw/branch/main/notes/" +
d.name +
".txt"
);
})*/
.attr("xlink:href", function (d) {
// stesso nome ma senza [N] per il file delle note
var baseName = d.name.replace(/\s*\[N\]$/, "");
return "viewer.html?file=notes/" + baseName + ".md";
})
.append("svg:text")
.attr("x", function (d) {
// Get the sibling text element (the node name) and calculate position
@ -134,6 +131,7 @@ function update(source) {
.style("font-size", "0.85em") // Smaller font
.style("fill-opacity", 1e-6)
.style("text-decoration", "underline");
// END OF NEW CODE
nodeEnter.append("svg:title").text(function (d) {