Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A Sphinx extension that provides utilities for embedding JupyterLite in your doc
:width: 100%
:height: 600px

print('Hello from a JupyterLite console!')
print("Hello from a JupyterLite console!")

.. toctree::
:caption: Installation
Expand Down
10 changes: 7 additions & 3 deletions src/jupyterlite_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from pathlib import Path

from urllib.parse import quote

import subprocess

from docutils.parsers.rst import directives
Expand Down Expand Up @@ -58,12 +60,14 @@ def __init__(
def html(self):
replite_options = self["replite_options"]

code_lines = [line.strip().replace(" ", "%20") for line in self["content"]]
code = "%0A".join(code_lines)
code_lines = [line.strip() for line in self["content"]]
code = "\n".join(code_lines)

replite_options["code"] = code

options = "&".join([f"{key}={value}" for key, value in replite_options.items()])
options = "&".join(
[f"{key}={quote(value)}" for key, value in replite_options.items()]
)

return (
f'<iframe src="{JUPYTERLITE_DIR}/repl/index.html?{options}"'
Expand Down