Skip to content

Commit

Permalink
Deployed debdbc3 with MkDocs version: 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 10, 2024
0 parents commit b4c4f84
Show file tree
Hide file tree
Showing 56 changed files with 13,260 additions and 0 deletions.
Empty file added .nojekyll
Empty file.
663 changes: 663 additions & 0 deletions 404.html

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions assets/_markdown_exec_pyodide.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
html[data-theme="light"] {
@import "https://cdn.jsdelivr.net/npm/highlightjs-themes@1.0.0/tomorrow.css"
}

html[data-theme="dark"] {
@import "https://cdn.jsdelivr.net/npm/highlightjs-themes@1.0.0/tomorrow-night-blue.min.css"
}


.ace_gutter {
z-index: 1;
}

.pyodide-editor {
width: 100%;
min-height: 200px;
max-height: 400px;
font-size: .85em;
}

.pyodide-editor-bar {
color: var(--md-primary-bg-color);
background-color: var(--md-primary-fg-color);
width: 100%;
font: monospace;
font-size: 0.75em;
padding: 2px 0 2px;
}

.pyodide-bar-item {
padding: 0 18px 0;
display: inline-block;
width: 50%;
}

.pyodide pre {
margin: 0;
}

.pyodide-output {
width: 100%;
margin-bottom: -15px;
min-height: 46px;
max-height: 400px
}

.pyodide-clickable {
cursor: pointer;
text-align: right;
}
109 changes: 109 additions & 0 deletions assets/_markdown_exec_pyodide.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
var _sessions = {};

function getSession(name, pyodide) {
if (!(name in _sessions)) {
_sessions[name] = pyodide.globals.get("dict")();
}
return _sessions[name];
}

function writeOutput(element, string) {
element.innerHTML += string + '\n';
}

function clearOutput(element) {
element.innerHTML = '';
}

async function evaluatePython(pyodide, editor, output, session) {
pyodide.setStdout({ batched: (string) => { writeOutput(output, string); } });
let result, code = editor.getValue();
clearOutput(output);
try {
result = await pyodide.runPythonAsync(code, { globals: getSession(session, pyodide) });
} catch (error) {
writeOutput(output, error);
}
if (result) writeOutput(output, result);
hljs.highlightElement(output);
}

async function initPyodide() {
try {
let pyodide = await loadPyodide();
await pyodide.loadPackage("micropip");
return pyodide;
} catch(error) {
return null;
}
}

function getTheme() {
return document.body.getAttribute('data-md-color-scheme');
}

function setTheme(editor, currentTheme, light, dark) {
// https://gist.github.com/RyanNutt/cb8d60997d97905f0b2aea6c3b5c8ee0
if (currentTheme === "default") {
editor.setTheme("ace/theme/" + light);
document.querySelector(`link[title="light"]`).removeAttribute("disabled");
document.querySelector(`link[title="dark"]`).setAttribute("disabled", "disabled");
} else if (currentTheme === "slate") {
editor.setTheme("ace/theme/" + dark);
document.querySelector(`link[title="dark"]`).removeAttribute("disabled");
document.querySelector(`link[title="light"]`).setAttribute("disabled", "disabled");
}
}

function updateTheme(editor, light, dark) {
// Create a new MutationObserver instance
const observer = new MutationObserver((mutations) => {
// Loop through the mutations that occurred
mutations.forEach((mutation) => {
// Check if the mutation was a change to the data-md-color-scheme attribute
if (mutation.attributeName === 'data-md-color-scheme') {
// Get the new value of the attribute
const newColorScheme = mutation.target.getAttribute('data-md-color-scheme');
// Update the editor theme
setTheme(editor, newColorScheme, light, dark);
}
});
});

// Configure the observer to watch for changes to the data-md-color-scheme attribute
observer.observe(document.body, {
attributes: true,
attributeFilter: ['data-md-color-scheme'],
});
}

async function setupPyodide(idPrefix, install = null, themeLight = 'tomorrow', themeDark = 'tomorrow_night', session = null) {
const editor = ace.edit(idPrefix + "editor");
const run = document.getElementById(idPrefix + "run");
const clear = document.getElementById(idPrefix + "clear");
const output = document.getElementById(idPrefix + "output");

updateTheme(editor, themeLight, themeDark);

editor.session.setMode("ace/mode/python");
setTheme(editor, getTheme(), themeLight, themeDark);

writeOutput(output, "Initializing...");
let pyodide = await pyodidePromise;
if (install && install.length) {
micropip = pyodide.pyimport("micropip");
for (const package of install)
await micropip.install(package);
}
clearOutput(output);
run.onclick = () => evaluatePython(pyodide, editor, output, session);
clear.onclick = () => clearOutput(output);
output.parentElement.parentElement.addEventListener("keydown", (event) => {
if (event.ctrlKey && event.key.toLowerCase() === 'enter') {
event.preventDefault();
run.click();
}
});
}

var pyodidePromise = initPyodide();
Empty file added assets/_mkdocstrings.css
Empty file.
Binary file added assets/images/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions assets/javascripts/bundle.fe8b6f2b.min.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions assets/javascripts/bundle.fe8b6f2b.min.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/javascripts/lunr/min/lunr.ar.min.js

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions assets/javascripts/lunr/min/lunr.da.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions assets/javascripts/lunr/min/lunr.de.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b4c4f84

Please sign in to comment.