Skip to content
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

Remove MyST inline directives from JupyterLite notebooks #5311

Merged
merged 1 commit into from
Jul 24, 2023
Merged
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
7 changes: 6 additions & 1 deletion scripts/panelite/generate_panelite_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json
import os
import pathlib
import re
import shutil

from test.notebooks_with_panelite_issues import NOTEBOOK_ISSUES
Expand All @@ -20,6 +21,8 @@
BASE_DEPENDENCIES = ['panel', 'pyodide-http']
MINIMUM_VERSIONS = {}

INLINE_DIRECTIVE = re.compile('\{.*\}`.*`\s*')

# Add piplite command to notebooks
with open(DOC_DIR / 'pyodide_dependencies.json', encoding='utf8') as file:
DEPENDENCIES = json.load(file)
Expand Down Expand Up @@ -104,6 +107,9 @@ def convert_md_to_nb(
# EOF
break

# Remove MyST-Directives
line = INLINE_DIRECTIVE.sub('', line)

lsline = line.lstrip()
if inblock:
if lsline.startswith(block_opener):
Expand Down Expand Up @@ -139,7 +145,6 @@ def convert_docs():
list(DOC_DIR.glob('explanation/**/*.md')) +
list(DOC_DIR.glob('how_to/**/*.md'))
)
print(mds)
for md in mds:
out = LITE_FILES / md.relative_to(DOC_DIR).with_suffix('.ipynb')
out.parent.mkdir(parents=True, exist_ok=True)
Expand Down