From f30f607b0c436efc1851e431089d072ac97375f0 Mon Sep 17 00:00:00 2001 From: Daniel Thompson-Yvetot Date: Thu, 19 Sep 2019 20:53:42 +0200 Subject: [PATCH 1/4] feat(https): use https in SVGs --- src/diagrams/flowchart/flowRenderer.js | 14 +++++++------- src/diagrams/git/gitGraphRenderer.js | 2 +- src/diagrams/info/parser/info.jison | 4 ++-- src/diagrams/pie/parser/pie.jison | 8 ++++---- src/mermaidAPI.js | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js index ef696a8f7..64d471c24 100644 --- a/src/diagrams/flowchart/flowRenderer.js +++ b/src/diagrams/flowchart/flowRenderer.js @@ -83,13 +83,13 @@ export const addVertices = function(vert, g, svgId) { vertexNode = addHtmlLabel(svg, node).node(); vertexNode.parentNode.removeChild(vertexNode); } else { - const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text'); + const svgLabel = document.createElementNS('https://www.w3.org/2000/svg', 'text'); const rows = vertexText.split(//); for (let j = 0; j < rows.length; j++) { - const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan'); - tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve'); + const tspan = document.createElementNS('https://www.w3.org/2000/svg', 'tspan'); + tspan.setAttributeNS('https://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve'); tspan.setAttribute('dy', '1em'); tspan.setAttribute('x', '1'); tspan.textContent = rows[j]; @@ -100,9 +100,9 @@ export const addVertices = function(vert, g, svgId) { // If the node has a link, we wrap it in a SVG link if (vertex.link) { - const link = document.createElementNS('http://www.w3.org/2000/svg', 'a'); - link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link); - link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener'); + const link = document.createElementNS('https://www.w3.org/2000/svg', 'a'); + link.setAttributeNS('https://www.w3.org/2000/svg', 'href', vertex.link); + link.setAttributeNS('https://www.w3.org/2000/svg', 'rel', 'noopener'); link.appendChild(vertexNode); vertexNode = link; } @@ -609,7 +609,7 @@ export const draw = function(text, id) { // Get dimensions of label const dim = label.getBBox(); - const rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect'); + const rect = document.createElementNS('https://www.w3.org/2000/svg', 'rect'); rect.setAttribute('rx', 0); rect.setAttribute('ry', 0); rect.setAttribute('width', dim.width); diff --git a/src/diagrams/git/gitGraphRenderer.js b/src/diagrams/git/gitGraphRenderer.js index 9a66141a0..f72db392d 100644 --- a/src/diagrams/git/gitGraphRenderer.js +++ b/src/diagrams/git/gitGraphRenderer.js @@ -48,7 +48,7 @@ function svgCreateDefs(svg) { .attr('x', config.nodeLabel.x) .attr('y', config.nodeLabel.y) .attr('class', 'node-label') - .attr('requiredFeatures', 'http://www.w3.org/TR/SVG11/feature#Extensibility') + .attr('requiredFeatures', 'https://www.w3.org/TR/SVG11/feature#Extensibility') .append('p') .html(''); } diff --git a/src/diagrams/info/parser/info.jison b/src/diagrams/info/parser/info.jison index 10a74e9c7..473b63fcf 100644 --- a/src/diagrams/info/parser/info.jison +++ b/src/diagrams/info/parser/info.jison @@ -1,5 +1,5 @@ /** mermaid - * http://knsv.github.io/mermaid/ + * https://knsv.github.io/mermaid * (c) 2015 Knut Sveidqvist * MIT license. */ @@ -45,4 +45,4 @@ statement : showInfo { yy.setInfo(true); } ; -%% \ No newline at end of file +%% diff --git a/src/diagrams/pie/parser/pie.jison b/src/diagrams/pie/parser/pie.jison index 994f87264..be6fcf214 100644 --- a/src/diagrams/pie/parser/pie.jison +++ b/src/diagrams/pie/parser/pie.jison @@ -1,5 +1,5 @@ /** mermaid - * http://knsv.github.io/mermaid/ + * https://knsv.github.io/mermaid * (c) 2015 Knut Sveidqvist * MIT license. */ @@ -48,10 +48,10 @@ line ; statement - : STR VALUE { + : STR VALUE { console.log('str:'+$1+' value: '+$2) yy.addSection($1,yy.cleanupValue($2)); } - | title {yy.setTitle($1.substr(6));$$=$1.substr(6);} + | title {yy.setTitle($1.substr(6));$$=$1.substr(6);} ; -%% \ No newline at end of file +%% diff --git a/src/mermaidAPI.js b/src/mermaidAPI.js index baa08b0e0..6d0c9eec6 100644 --- a/src/mermaidAPI.js +++ b/src/mermaidAPI.js @@ -426,7 +426,7 @@ const render = function(id, txt, cb, container) { .append('svg') .attr('id', id) .attr('width', '100%') - .attr('xmlns', 'http://www.w3.org/2000/svg') + .attr('xmlns', 'https://www.w3.org/2000/svg') .append('g'); } else { const element = document.querySelector('#' + 'd' + id); @@ -440,7 +440,7 @@ const render = function(id, txt, cb, container) { .append('svg') .attr('id', id) .attr('width', '100%') - .attr('xmlns', 'http://www.w3.org/2000/svg') + .attr('xmlns', 'https://www.w3.org/2000/svg') .append('g'); } @@ -535,7 +535,7 @@ const render = function(id, txt, cb, container) { d3.select(`[id="${id}"]`) .selectAll('foreignobject > *') - .attr('xmlns', 'http://www.w3.org/1999/xhtml'); + .attr('xmlns', 'https://www.w3.org/1999/xhtml'); let url = ''; if (config.arrowMarkerAbsolute) { From 7ca13fd16348faa3f6294c8dc3e899339c17e720 Mon Sep 17 00:00:00 2001 From: nothingismagick Date: Mon, 23 Sep 2019 12:04:39 +0200 Subject: [PATCH 2/4] revert to http --- src/diagrams/flowchart/flowRenderer.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js index 64d471c24..ef696a8f7 100644 --- a/src/diagrams/flowchart/flowRenderer.js +++ b/src/diagrams/flowchart/flowRenderer.js @@ -83,13 +83,13 @@ export const addVertices = function(vert, g, svgId) { vertexNode = addHtmlLabel(svg, node).node(); vertexNode.parentNode.removeChild(vertexNode); } else { - const svgLabel = document.createElementNS('https://www.w3.org/2000/svg', 'text'); + const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text'); const rows = vertexText.split(//); for (let j = 0; j < rows.length; j++) { - const tspan = document.createElementNS('https://www.w3.org/2000/svg', 'tspan'); - tspan.setAttributeNS('https://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve'); + const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan'); + tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve'); tspan.setAttribute('dy', '1em'); tspan.setAttribute('x', '1'); tspan.textContent = rows[j]; @@ -100,9 +100,9 @@ export const addVertices = function(vert, g, svgId) { // If the node has a link, we wrap it in a SVG link if (vertex.link) { - const link = document.createElementNS('https://www.w3.org/2000/svg', 'a'); - link.setAttributeNS('https://www.w3.org/2000/svg', 'href', vertex.link); - link.setAttributeNS('https://www.w3.org/2000/svg', 'rel', 'noopener'); + const link = document.createElementNS('http://www.w3.org/2000/svg', 'a'); + link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link); + link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener'); link.appendChild(vertexNode); vertexNode = link; } @@ -609,7 +609,7 @@ export const draw = function(text, id) { // Get dimensions of label const dim = label.getBBox(); - const rect = document.createElementNS('https://www.w3.org/2000/svg', 'rect'); + const rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect'); rect.setAttribute('rx', 0); rect.setAttribute('ry', 0); rect.setAttribute('width', dim.width); From 4f218435e36edeebfbaa046996f28ed81fb8894f Mon Sep 17 00:00:00 2001 From: nothingismagick Date: Mon, 23 Sep 2019 12:05:13 +0200 Subject: [PATCH 3/4] revert to http --- src/diagrams/git/gitGraphRenderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diagrams/git/gitGraphRenderer.js b/src/diagrams/git/gitGraphRenderer.js index f72db392d..9a66141a0 100644 --- a/src/diagrams/git/gitGraphRenderer.js +++ b/src/diagrams/git/gitGraphRenderer.js @@ -48,7 +48,7 @@ function svgCreateDefs(svg) { .attr('x', config.nodeLabel.x) .attr('y', config.nodeLabel.y) .attr('class', 'node-label') - .attr('requiredFeatures', 'https://www.w3.org/TR/SVG11/feature#Extensibility') + .attr('requiredFeatures', 'http://www.w3.org/TR/SVG11/feature#Extensibility') .append('p') .html(''); } From 6c243488fa5dec9ea1d3805f1e725f5ebea0d3c1 Mon Sep 17 00:00:00 2001 From: nothingismagick Date: Mon, 23 Sep 2019 12:06:22 +0200 Subject: [PATCH 4/4] revert to http --- src/mermaidAPI.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mermaidAPI.js b/src/mermaidAPI.js index 6d0c9eec6..baa08b0e0 100644 --- a/src/mermaidAPI.js +++ b/src/mermaidAPI.js @@ -426,7 +426,7 @@ const render = function(id, txt, cb, container) { .append('svg') .attr('id', id) .attr('width', '100%') - .attr('xmlns', 'https://www.w3.org/2000/svg') + .attr('xmlns', 'http://www.w3.org/2000/svg') .append('g'); } else { const element = document.querySelector('#' + 'd' + id); @@ -440,7 +440,7 @@ const render = function(id, txt, cb, container) { .append('svg') .attr('id', id) .attr('width', '100%') - .attr('xmlns', 'https://www.w3.org/2000/svg') + .attr('xmlns', 'http://www.w3.org/2000/svg') .append('g'); } @@ -535,7 +535,7 @@ const render = function(id, txt, cb, container) { d3.select(`[id="${id}"]`) .selectAll('foreignobject > *') - .attr('xmlns', 'https://www.w3.org/1999/xhtml'); + .attr('xmlns', 'http://www.w3.org/1999/xhtml'); let url = ''; if (config.arrowMarkerAbsolute) {