-
-
Notifications
You must be signed in to change notification settings - Fork 257
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
can't have more than 2 sequence diagrams in each page #1
Comments
Yeah, my Javascript skills are pretty week as I am not a web developer. I am sure JS code is bombing. I just haven't tested more than two until now. Extensions are still in a beta state as a couple of things like this turn up now and then. Thanks for the report. I'll figure it out and let you know. |
I think these extensions are great, thank you for that! I got a fork and I wished to try to solve this by myself but I didn't understand how to set an environment up to edit it. If you could send me some clues, maybe I could do it here and send a pull request... (is that a matter of JS code? I thought it was a python issue...) |
Nah, it's without a doubt JS. My Python-fu is much greater than my JS-fu. I assume you are using the JS that I provided. I guess that is the next question, how are you loading things up? On my end, everything is actually classed up just fine in HTML. Python code actually just has an exception for Basically, I was supposed to be looping through the pre objects that were classed up as Something changes after the first two blocks are processed, because the parentNodes of anything after the first two suddenly become (function (win, doc) {
win.convertUML = function(className, converter, settings) {
var charts = doc.querySelectorAll("pre." + className),
arr = [],
i, maxItem, diagaram, text, curNode;
// Is there a settings object?
if (settings === void 0) {
settings = {};
}
// Make sure we are dealing with an array
for(i = 0, maxItem = charts.length; i < maxItem; i++) arr.push(charts[i])
// Find the UML source element and get the text
for (i = 0, maxItem = arr.length; i < maxItem; i++) {
childEl = arr[i].firstChild;
parentEl = childEl.parentNode;
text = "";
for (var i = 0; i < childEl.childNodes.length; i++) {
curNode = childEl.childNodes[i];
whitespace = /^\s*$/;
if (curNode.nodeName === "#text" && !(whitespace.test(curNode.nodeValue))) {
text = curNode.nodeValue;
break;
}
}
// Do UML conversion and replace source
el = doc.createElement('div');
el.className = className;
parentEl.parentNode.insertBefore(el, parentEl);
parentEl.parentNode.removeChild(parentEl);
diagram = converter.parse(text);
diagram.drawSVG(el, settings);
}
}
})(window, document) |
Hah, I'm an idiot. Man those This worked for me. Notice above I am reusing (function (win, doc) {
win.convertUML = function(className, converter, settings) {
var charts = doc.querySelectorAll("pre." + className),
arr = [],
i, j, maxItem, diagaram, text, curNode;
// Is there a settings object?
if (settings === void 0) {
settings = {};
}
// Make sure we are dealing with an array
for(i = 0, maxItem = charts.length; i < maxItem; i++) arr.push(charts[i])
// Find the UML source element and get the text
for (i = 0, maxItem = arr.length; i < maxItem; i++) {
childEl = arr[i].firstChild;
parentEl = childEl.parentNode;
text = "";
for (j = 0; j < childEl.childNodes.length; j++) {
curNode = childEl.childNodes[j];
whitespace = /^\s*$/;
if (curNode.nodeName === "#text" && !(whitespace.test(curNode.nodeValue))) {
text = curNode.nodeValue;
break;
}
}
// Do UML conversion and replace source
el = doc.createElement('div');
el.className = className;
parentEl.parentNode.insertBefore(el, parentEl);
parentEl.parentNode.removeChild(parentEl);
diagram = converter.parse(text);
diagram.drawSVG(el, settings);
}
}
})(window, document) |
If your issue was the same as mine, I will commit this and hopefully your issue will be fixed. |
I tried it here and it worked for me too. Thanks! |
Yeah, I'll do it. I have a push I havn't committed yet. I'll add it to that. |
👍 👍 👍 👍 |
Reopenning until I actually push the fix. |
The extension itself doesn't provide the JS file, that is provided by PyMdown or Markdown Preview in this case. But the file has been updated in PyMdown facelessuser/PyMdown@884fc6a. |
This has been merged in Markdown Preview and released. |
It's not possible to add more than 2 sequence diagrams in each page. After that, all code blocks are rendered as simple code blocks. I have also tried with flow charts and the behavior is the same...
That's my test.
The text was updated successfully, but these errors were encountered: