-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also upgrade default version to 0.26.4. Issue-66: #66 PR-67: #67 Co-authored-by: Timothée Mazzucotelli <[email protected]>
- Loading branch information
Showing
2 changed files
with
15 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
assets = """ | ||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.16.0/ace.js"></script> | ||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script> | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/pyodide/v0.23.0/full/pyodide.js"></script> | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/pyodide/v{version}/full/pyodide.js"></script> | ||
<link title="light" rel="alternate stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/tomorrow.min.css" disabled="disabled"> | ||
<link title="dark" rel="alternate stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/tomorrow-night-blue.min.css" disabled="disabled"> | ||
""" | ||
|
@@ -46,6 +46,7 @@ | |
def _format_pyodide(code: str, md: Markdown, session: str, extra: dict, **options: Any) -> str: # noqa: ARG001 | ||
global _counter # noqa: PLW0603 | ||
_counter += 1 | ||
version = extra.pop("version", "0.26.4").lstrip("v") | ||
install = extra.pop("install", "") | ||
install = install.split(",") if install else [] | ||
exclude_assets = extra.pop("assets", "1").lower() in {"0", "false", "no", "off"} | ||
|
@@ -66,4 +67,4 @@ def _format_pyodide(code: str, md: Markdown, session: str, extra: dict, **option | |
rendered = template % data | ||
if exclude_assets: | ||
return rendered | ||
return assets + rendered | ||
return assets.format(version=version) + rendered |