-
Notifications
You must be signed in to change notification settings - Fork 105
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
HTML exported with broken layout if both kandy and dataframe added #414
Comments
Hi! Where have you done this? |
Hi again! I'm using Diffing the notebook saved after "run all" vs. the notebook saved after re-running the first cell suggests the first cell's outputs are the cause. --- tooling/jupyter-notebooks/Untitled4.ipynb.prob 2023-05-12 18:38:01
+++ tooling/jupyter-notebooks/Untitled4.ipynb 2023-05-12 18:38:05
@@ -2,268 +2,12 @@
"cells": [
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 3,
"id": "5d5ac1ec-b509-4df3-9e3f-6e8621c326f6",
"metadata": {
"tags": []
},
- "outputs": [
- {
- "data": {
- "text/html": [
- " <div id=\"kotlin_out_0\"/>\n",
- " <script type=\"text/javascript\">\n",
- " if(!window.kotlinQueues) {\n",
- " window.kotlinQueues = {};\n",
- " }\n",
- " if(!window.kotlinQueues[\"kandyLetsPlot\"]) {\n",
- " var resQueue = [];\n",
- " window.kotlinQueues[\"kandyLetsPlot\"] = resQueue;\n",
- " window[\"call_kandyLetsPlot\"] = function(f) {\n",
- " resQueue.push(f);\n",
- " }\n",
- " }\n",
- " (function (){\n",
- " var modifiers = [(function(script) {\n",
- " script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v3.1.0/js-package/distr/lets-plot.min.js\"\n",
- " script.type = \"text/javascript\";\n",
- "})];\n",
- " var e = document.getElementById(\"kotlin_out_0\");\n",
- " modifiers.forEach(function (gen) {\n",
- " var script = document.createElement(\"script\");\n",
- " gen(script)\n",
- " script.addEventListener(\"load\", function() {\n",
- " window[\"call_kandyLetsPlot\"] = function(f) {f();};\n",
- " window.kotlinQueues[\"kandyLetsPlot\"].forEach(function(f) {f();});\n",
- " window.kotlinQueues[\"kandyLetsPlot\"] = [];\n",
- " }, false);\n",
- " script.addEventListener(\"error\", function() {\n",
- " window[\"call_kandyLetsPlot\"] = function(f) {};\n",
- " window.kotlinQueues[\"kandyLetsPlot\"] = [];\n",
- " var div = document.createElement(\"div\");\n",
- " div.style.color = 'darkred';\n",
- " div.textContent = 'Error loading resource kandyLetsPlot';\n",
- " document.getElementById(\"kotlin_out_0\").appendChild(div);\n",
- " }, false);\n",
- " \n",
- " e.appendChild(script);\n",
- " });\n",
- " })();\n",
- " </script>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/html": [
- " <div id=\"kotlin_out_1\"/>\n",
- " <script type=\"text/javascript\">\n",
- " if(!window.kotlinQueues) {\n",
- " window.kotlinQueues = {};\n",
- " }\n",
- " if(!window.kotlinQueues[\"DataFrame\"]) {\n",
- " var resQueue = [];\n",
- " window.kotlinQueues[\"DataFrame\"] = resQueue;\n",
- " window[\"call_DataFrame\"] = function(f) {\n",
- " resQueue.push(f);\n",
- " }\n",
- " }\n",
- " (function (){\n",
- " var modifiers = [(function(script) {\n",
- " script.src = \"https://cdn.jsdelivr.net/gh/Kotlin/dataframe@3db46ccccaa1291c0627307d64133317f545e6ae/core/src/main/resources/init.js\"\n",
- " script.type = \"text/javascript\";\n",
- "})];\n",
- " var e = document.getElementById(\"kotlin_out_1\");\n",
- " modifiers.forEach(function (gen) {\n",
- " var script = document.createElement(\"script\");\n",
- " gen(script)\n",
- " script.addEventListener(\"load\", function() {\n",
- " window[\"call_DataFrame\"] = function(f) {f();};\n",
- " window.kotlinQueues[\"DataFrame\"].forEach(function(f) {f();});\n",
- " window.kotlinQueues[\"DataFrame\"] = [];\n",
- " }, false);\n",
- " script.addEventListener(\"error\", function() {\n",
- " window[\"call_DataFrame\"] = function(f) {};\n",
- " window.kotlinQueues[\"DataFrame\"] = [];\n",
- " var div = document.createElement(\"div\");\n",
- " div.style.color = 'darkred';\n",
- " div.textContent = 'Error loading resource DataFrame';\n",
- " document.getElementById(\"kotlin_out_1\").appendChild(div);\n",
- " }, false);\n",
- " \n",
- " e.appendChild(script);\n",
- " });\n",
- " })();\n",
- " </script>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/html": [
- " <style>\n",
- " :root {\n",
- " --background: #fff;\n",
- " --background-odd: #f5f5f5;\n",
- " --background-hover: #d9edfd;\n",
- " --header-text-color: #474747;\n",
- " --text-color: #848484;\n",
- " --text-color-dark: #000;\n",
- " --text-color-medium: #737373;\n",
- " --text-color-pale: #b3b3b3;\n",
- " --inner-border-color: #aaa;\n",
- " --bold-border-color: #000;\n",
- " --link-color: #296eaa;\n",
- " --link-color-pale: #296eaa;\n",
- " --link-hover: #1a466c;\n",
- "}\n",
- "\n",
- ":root[theme=\"dark\"], :root [data-jp-theme-light=\"false\"], .dataframe_dark{\n",
- " --background: #303030;\n",
- " --background-odd: #3c3c3c;\n",
- " --background-hover: #464646;\n",
- " --header-text-color: #dddddd;\n",
- " --text-color: #b3b3b3;\n",
- " --text-color-dark: #dddddd;\n",
- " --text-color-medium: #b2b2b2;\n",
- " --text-color-pale: #737373;\n",
- " --inner-border-color: #707070;\n",
- " --bold-border-color: #777777;\n",
- " --link-color: #008dc0;\n",
- " --link-color-pale: #97e1fb;\n",
- " --link-hover: #00688e;\n",
- "}\n",
- "\n",
- "p.dataframe_description {\n",
- " color: var(--text-color-dark);\n",
- "}\n",
- "\n",
- "table.dataframe {\n",
- " font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n",
- " font-size: 12px;\n",
- " background-color: var(--background);\n",
- " color: var(--text-color-dark);\n",
- " border: none;\n",
- " border-collapse: collapse;\n",
- "}\n",
- "\n",
- "table.dataframe th, td {\n",
- " padding: 6px;\n",
- " border: 1px solid transparent;\n",
- " text-align: left;\n",
- "}\n",
- "\n",
- "table.dataframe th {\n",
- " background-color: var(--background);\n",
- " color: var(--header-text-color);\n",
- "}\n",
- "\n",
- "table.dataframe td {\n",
- " vertical-align: top;\n",
- "}\n",
- "\n",
- "table.dataframe th.bottomBorder {\n",
- " border-bottom-color: var(--bold-border-color);\n",
- "}\n",
- "\n",
- "table.dataframe tbody > tr:nth-child(odd) {\n",
- " background: var(--background-odd);\n",
- "}\n",
- "\n",
- "table.dataframe tbody > tr:nth-child(even) {\n",
- " background: var(--background);\n",
- "}\n",
- "\n",
- "table.dataframe tbody > tr:hover {\n",
- " background: var(--background-hover);\n",
- "}\n",
- "\n",
- "table.dataframe a {\n",
- " cursor: pointer;\n",
- " color: var(--link-color);\n",
- " text-decoration: none;\n",
- "}\n",
- "\n",
- "table.dataframe tr:hover > td a {\n",
- " color: var(--link-color-pale);\n",
- "}\n",
- "\n",
- "table.dataframe a:hover {\n",
- " color: var(--link-hover);\n",
- " text-decoration: underline;\n",
- "}\n",
- "\n",
- "table.dataframe img {\n",
- " max-width: fit-content;\n",
- "}\n",
- "\n",
- "table.dataframe th.complex {\n",
- " background-color: var(--background);\n",
- " border: 1px solid var(--background);\n",
- "}\n",
- "\n",
- "table.dataframe .leftBorder {\n",
- " border-left-color: var(--inner-border-color);\n",
- "}\n",
- "\n",
- "table.dataframe .rightBorder {\n",
- " border-right-color: var(--inner-border-color);\n",
- "}\n",
- "\n",
- "table.dataframe .rightAlign {\n",
- " text-align: right;\n",
- "}\n",
- "\n",
- "table.dataframe .expanderSvg {\n",
- " width: 8px;\n",
- " height: 8px;\n",
- " margin-right: 3px;\n",
- "}\n",
- "\n",
- "table.dataframe .expander {\n",
- " display: flex;\n",
- " align-items: center;\n",
- "}\n",
- "\n",
- "/* formatting */\n",
- "\n",
- "table.dataframe .null {\n",
- " color: var(--text-color-pale);\n",
- "}\n",
- "\n",
- "table.dataframe .structural {\n",
- " color: var(--text-color-medium);\n",
- " font-weight: bold;\n",
- "}\n",
- "\n",
- "table.dataframe .dataFrameCaption {\n",
- " font-weight: bold;\n",
- "}\n",
- "\n",
- "table.dataframe .numbers {\n",
- " color: var(--text-color-dark);\n",
- "}\n",
- "\n",
- "table.dataframe td:hover .formatted .structural, .null {\n",
- " color: var(--text-color-dark);\n",
- "}\n",
- "\n",
- "table.dataframe tr:hover .formatted .structural, .null {\n",
- " color: var(--text-color-dark);\n",
- "}\n",
- "\n",
- "\n",
- " </style>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"%useLatestDescriptors\n",
"%use kandy\n",
|
I would say it's converter's issue because generated HTML is obviously incorrect. it's not about incorrect styles or things like that |
Removing either dataframe's or kandy's initial output solves the problem that makes things even stranger |
Yep, that's strange, they become narrower)) It might be because of JS, but very unlikely... I'm not even sure this converter executes JS somehow if it's written in python |
I found a problem. It's indeed in kernel! Thanks for the nice catch, I'll push the fix today |
Version 0.11.0.385 |
Thank you! Can confirm it's working fine on this version |
I'm not sure if this is a Kernel issue, please let me know if I should move it somewhere else. I was able to narrow it down to this peculiar scenario, but I'm able to reproduce it 100% like this.
Expected
HTML is exported and displays cells on the layout of a single column
Actual
HTML is exported and displays cells on a strange layout. Any cells coming after the
println("0")
cell are added further to the right of this cell.Note: if you re-run the first cell and export again, the exported HTML then has the expected layout. Issue occurs only on the first run of the cell, as with "restart and run all".
Environment info
Python 3.11.2
The text was updated successfully, but these errors were encountered: