@@ -9,7 +9,7 @@ const mdFilePath = process.env.npm_config_markDownFilePath || "../../measuring";
9
9
const graph = getGQMFileLinks ( mdFilePath ) ;
10
10
11
11
export function getLinkUrl ( linkType : LinkType , file : string ) {
12
- const measuringUrl = "https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring/ " ;
12
+ const measuringUrl = "https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring" ;
13
13
const url = `${ measuringUrl } /${ linkType . toLowerCase ( ) } s/${ file } `
14
14
return url ;
15
15
}
@@ -127,7 +127,7 @@ export function getLinks(parsed: Commonmark.Node) {
127
127
128
128
export function getNodeShapeSyntax ( node : Node ) {
129
129
const nodeUrl = getLinkUrl ( node . type , node . id )
130
- const nodeLabel = `<a href=' ${ nodeUrl } '> ${ node . label } </a> ` ;
130
+ const nodeLabel = `${ node . label } ` ;
131
131
switch ( node . shape ) {
132
132
case 'rect' :
133
133
return `[${ nodeLabel } ]` ;
@@ -150,16 +150,31 @@ export function generateMermaidDiagram(graph: Graph) {
150
150
subgraph GQM[Goals, Questions, Metrics]\n
151
151
` ;
152
152
153
+ mermaidSyntax += " %% begin nodes\n" ;
153
154
nodes . forEach ( ( node ) => {
154
155
const nodeSyntax = getNodeShapeSyntax ( node )
155
156
mermaidSyntax += ` ${ node . id } ${ nodeSyntax } \n`
156
157
} ) ;
158
+ mermaidSyntax += " %% end nodes\n\n" ;
159
+
160
+ mermaidSyntax += " %% begin edges\n" ;
157
161
158
162
edges . forEach ( ( edge ) => {
159
163
const arrowSyntax : string = ArrowType . ARROW ;
160
164
mermaidSyntax += ` ${ edge . from } ${ arrowSyntax } ${ edge . to } \n` ;
161
165
} ) ;
162
166
167
+ mermaidSyntax += " %% end edges\n\n" ;
168
+
169
+ mermaidSyntax += " %% begin clicks\n"
170
+
171
+ nodes . forEach ( ( node ) => {
172
+ const nodeUrl = getLinkUrl ( node . type , node . id ) ;
173
+ mermaidSyntax += ` click ${ node . id } "${ nodeUrl } " "${ node . label } "\n` ;
174
+ } ) ;
175
+
176
+ mermaidSyntax += " %% end clicks\n\n"
177
+
163
178
const goalsList = nodes . filter ( n => n . type == LinkType . GOAL ) . map ( n => `${ n . id } ` ) . join ( ',' ) ;
164
179
const questionsList = nodes . filter ( n => n . type == LinkType . QUESTION ) . map ( n => `${ n . id } ` ) . join ( ',' ) ;
165
180
const metricsList = nodes . filter ( n => n . type == LinkType . METRIC ) . map ( n => `${ n . id } ` ) . join ( ',' ) ;
0 commit comments