-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "1c1e9776", | ||
"metadata": {}, | ||
"source": [ | ||
"# Dark Themes\n", | ||
"\n", | ||
"When a notebook or application is rendered using a dark theme, DataTable requires that a `dark`\n", | ||
"class be added to the HTML document. This can be done with the following Javascript snippet:\n", | ||
"```javascript\n", | ||
"document.documentElement.classList.add('dark');\n", | ||
"```\n", | ||
"\n", | ||
"When ITables is used in a notebook, this is handled by\n", | ||
"`init_notebook_mode` which displays the [`init_datatables.html`](https://github.com/mwouts/itables/blob/main/src/itables/html/init_datatables.html) snippet.\n", | ||
"\n", | ||
"Please open a PR if you see how to further improve the\n", | ||
"support of light vs dark themes, and e.g. set the `dark`\n", | ||
"class dynamically when the theme is changed." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"jupytext": { | ||
"formats": "md:myst", | ||
"notebook_metadata_filter": "-jupytext.text_representation.jupytext_version", | ||
"text_representation": { | ||
"extension": ".md", | ||
"format_name": "myst", | ||
"format_version": 0.13 | ||
} | ||
}, | ||
"kernelspec": { | ||
"display_name": "itables", | ||
"language": "python", | ||
"name": "itables" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.9" | ||
}, | ||
"source_map": [ | ||
13 | ||
] | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
jupytext: | ||
formats: md:myst | ||
notebook_metadata_filter: -jupytext.text_representation.jupytext_version | ||
text_representation: | ||
extension: .md | ||
format_name: myst | ||
format_version: 0.13 | ||
kernelspec: | ||
display_name: itables | ||
language: python | ||
name: itables | ||
--- | ||
|
||
# Dark Themes | ||
|
||
When a notebook or application is rendered using a dark theme, DataTable requires that a `dark` | ||
class be added to the HTML document. This can be done with the following Javascript snippet: | ||
```javascript | ||
document.documentElement.classList.add('dark'); | ||
``` | ||
|
||
When ITables is used in a notebook, this is handled by | ||
`init_notebook_mode` which displays the [`init_datatables.html`](https://github.com/mwouts/itables/blob/main/src/itables/html/init_datatables.html) snippet. | ||
|
||
Please open a PR if you see how to further improve the | ||
support of light vs dark themes, and e.g. set the `dark` | ||
class dynamically when the theme is changed. |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8eb7fb69", | ||
"id": "95de48c4", | ||
"metadata": {}, | ||
"source": [ | ||
"# HTML export\n", | ||
|
@@ -13,7 +13,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "526c91aa", | ||
"id": "b3b6e772", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
|
@@ -28,7 +28,7 @@ | |
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "93017afc", | ||
"id": "5c73722d", | ||
"metadata": {}, | ||
"source": [ | ||
"You can then save the `html` variable to a text file (note: if you're writing an HTML application, you could consider using [Shiny](shiny.md) or [Streamlit](streamlit.md) instead), or print it:" | ||
|
@@ -37,7 +37,7 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "788f69a1", | ||
"id": "83aa67f4", | ||
"metadata": { | ||
"tags": [ | ||
"scroll-output" | ||
|
@@ -48,7 +48,7 @@ | |
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"<table id=\"itables_e47e3e40_d42c_479f_b0c8_b0bbe188f37b\" class=\"display nowrap\" data-quarto-disable-processing=\"true\" style=\"table-layout:auto;width:auto;margin:auto;caption-side:bottom\">\n", | ||
"<table id=\"itables_f8115103_a9d5_4824_b79b_24c521fafb46\" class=\"display nowrap\" data-quarto-disable-processing=\"true\" style=\"table-layout:auto;width:auto;margin:auto;caption-side:bottom\">\n", | ||
"<thead>\n", | ||
" <tr style=\"text-align: right;\">\n", | ||
" <th></th>\n", | ||
|
@@ -69,7 +69,7 @@ | |
" </thead><tbody><tr>\n", | ||
"<td style=\"vertical-align:middle; text-align:left\">\n", | ||
"<div>\n", | ||
"Loading ITables v2.1.4 from the internet...\n", | ||
"Loading ITables v2.1.5-dev from the internet...\n", | ||
"(need <a href=https://mwouts.github.io/itables/troubleshooting.html>help</a>?)</td>\n", | ||
"</div>\n", | ||
"</tr></tbody>\n", | ||
|
@@ -79,7 +79,7 @@ | |
"<script type=\"module\">\n", | ||
" import {DataTable, jQuery as $} from 'https://www.unpkg.com/[email protected]/dt_bundle.js';\n", | ||
"\n", | ||
" document.querySelectorAll(\"#itables_e47e3e40_d42c_479f_b0c8_b0bbe188f37b:not(.dataTable)\").forEach(table => {\n", | ||
" document.querySelectorAll(\"#itables_f8115103_a9d5_4824_b79b_24c521fafb46:not(.dataTable)\").forEach(table => {\n", | ||
" // Define the table data\n", | ||
" const data = [[\"AW\", \"Latin America & Caribbean \", \"Aruba\", \"Oranjestad\", -70.0167, 12.5167], [\"AF\", \"South Asia\", \"Afghanistan\", \"Kabul\", 69.1761, 34.5228], [\"AO\", \"Sub-Saharan Africa \", \"Angola\", \"Luanda\", 13.242, -8.81155]];\n", | ||
"\n", | ||
|
@@ -101,7 +101,7 @@ | |
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "5e65ed05", | ||
"id": "e8d8f6df", | ||
"metadata": {}, | ||
"source": [ | ||
"or display it, like `show` does:" | ||
|
@@ -110,13 +110,13 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "debf9f6a", | ||
"id": "057303f5", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<table id=\"itables_e47e3e40_d42c_479f_b0c8_b0bbe188f37b\" class=\"display nowrap\" data-quarto-disable-processing=\"true\" style=\"table-layout:auto;width:auto;margin:auto;caption-side:bottom\">\n", | ||
"<table id=\"itables_f8115103_a9d5_4824_b79b_24c521fafb46\" class=\"display nowrap\" data-quarto-disable-processing=\"true\" style=\"table-layout:auto;width:auto;margin:auto;caption-side:bottom\">\n", | ||
"<thead>\n", | ||
" <tr style=\"text-align: right;\">\n", | ||
" <th></th>\n", | ||
|
@@ -137,7 +137,7 @@ | |
" </thead><tbody><tr>\n", | ||
"<td style=\"vertical-align:middle; text-align:left\">\n", | ||
"<div>\n", | ||
"Loading ITables v2.1.4 from the internet...\n", | ||
"Loading ITables v2.1.5-dev from the internet...\n", | ||
"(need <a href=https://mwouts.github.io/itables/troubleshooting.html>help</a>?)</td>\n", | ||
"</div>\n", | ||
"</tr></tbody>\n", | ||
|
@@ -147,7 +147,7 @@ | |
"<script type=\"module\">\n", | ||
" import {DataTable, jQuery as $} from 'https://www.unpkg.com/[email protected]/dt_bundle.js';\n", | ||
"\n", | ||
" document.querySelectorAll(\"#itables_e47e3e40_d42c_479f_b0c8_b0bbe188f37b:not(.dataTable)\").forEach(table => {\n", | ||
" document.querySelectorAll(\"#itables_f8115103_a9d5_4824_b79b_24c521fafb46:not(.dataTable)\").forEach(table => {\n", | ||
" // Define the table data\n", | ||
" const data = [[\"AW\", \"Latin America & Caribbean \", \"Aruba\", \"Oranjestad\", -70.0167, 12.5167], [\"AF\", \"South Asia\", \"Afghanistan\", \"Kabul\", 69.1761, 34.5228], [\"AO\", \"Sub-Saharan Africa \", \"Angola\", \"Luanda\", 13.242, -8.81155]];\n", | ||
"\n", | ||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.