-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e43d123
Showing
26 changed files
with
7,357 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# app | ||
|
||
|
||
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> | ||
|
||
``` python | ||
from nb2fasthtml.core import * | ||
``` |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,190 @@ | ||
# nb | ||
|
||
|
||
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> | ||
|
||
``` html | ||
<script type="module" src="https://cdn.jsdelivr.net/npm/zero-md@3?register"></script> | ||
``` | ||
|
||
<script type="module" src="https://cdn.jsdelivr.net/npm/zero-md@3?register"></script> | ||
|
||
``` python | ||
example_nb_dir = Path('../example_nbs/') | ||
with open(example_nb_dir/'explaining_xt_components.ipynb', 'r') as f: xt_nb = json.load(f) | ||
``` | ||
|
||
------------------------------------------------------------------------ | ||
|
||
<a | ||
href="https://github.com/AnswerDotAI/nb2fasthtml/blob/main/nb2fasthtml/core.py#L14" | ||
target="_blank" style="float:right; font-size:smaller">source</a> | ||
|
||
### strip_list | ||
|
||
> strip_list (l, val='\n') | ||
------------------------------------------------------------------------ | ||
|
||
<a | ||
href="https://github.com/AnswerDotAI/nb2fasthtml/blob/main/nb2fasthtml/core.py#L21" | ||
target="_blank" style="float:right; font-size:smaller">source</a> | ||
|
||
### render_md | ||
|
||
> render_md (c) | ||
------------------------------------------------------------------------ | ||
|
||
<a | ||
href="https://github.com/AnswerDotAI/nb2fasthtml/blob/main/nb2fasthtml/core.py#L26" | ||
target="_blank" style="float:right; font-size:smaller">source</a> | ||
|
||
### render_md_cell | ||
|
||
> render_md_cell (cell) | ||
``` python | ||
# show(Div(*map(render_md_cell,[o for o in xt_nb['cells'][:3] if o['cell_type']=='markdown']))) | ||
``` | ||
|
||
------------------------------------------------------------------------ | ||
|
||
<a | ||
href="https://github.com/AnswerDotAI/nb2fasthtml/blob/main/nb2fasthtml/core.py#L31" | ||
target="_blank" style="float:right; font-size:smaller">source</a> | ||
|
||
### get_nb_lang | ||
|
||
> get_nb_lang (nb) | ||
------------------------------------------------------------------------ | ||
|
||
<a | ||
href="https://github.com/AnswerDotAI/nb2fasthtml/blob/main/nb2fasthtml/core.py#L35" | ||
target="_blank" style="float:right; font-size:smaller">source</a> | ||
|
||
### render_code_source | ||
|
||
> render_code_source (cell, lang='python') | ||
``` python | ||
# show(Div(*map(render_code_source,[o for o in xt_nb['cells'][:10] if o['cell_type']=='code']))) | ||
``` | ||
|
||
------------------------------------------------------------------------ | ||
|
||
<a | ||
href="https://github.com/AnswerDotAI/nb2fasthtml/blob/main/nb2fasthtml/core.py#L41" | ||
target="_blank" style="float:right; font-size:smaller">source</a> | ||
|
||
### render_code_output | ||
|
||
> render_code_output (cell, lang='python') | ||
``` python | ||
nbs_dir = Path('../example_nbs/') | ||
with open(nbs_dir/'00_core.ipynb', 'r') as f: nb = json.load(f) | ||
|
||
# render_code_output(nb['cells'][9]) | ||
``` | ||
|
||
``` python | ||
# show(Div(*map(render_code_output,[o for o in xt_nb['cells'][:20] if o['cell_type']=='code']))) | ||
``` | ||
|
||
------------------------------------------------------------------------ | ||
|
||
<a | ||
href="https://github.com/AnswerDotAI/nb2fasthtml/blob/main/nb2fasthtml/core.py#L56" | ||
target="_blank" style="float:right; font-size:smaller">source</a> | ||
|
||
### render_nb | ||
|
||
> render_nb (fpath, wrapper=functools.partial(<function ft_hx at | ||
> 0x7f08d34869e0>, 'main'), cls='container', | ||
> md_cell_wrapper=functools.partial(<function ft_hx at | ||
> 0x7f08d34869e0>, 'div'), md_fn=<function render_md_cell>, | ||
> code_cell_wrapper=<function Card>, cd_fn=<function | ||
> render_code_source>, out_fn=<function render_code_output>, | ||
> **kwargs) | ||
<table> | ||
<colgroup> | ||
<col style="width: 6%" /> | ||
<col style="width: 25%" /> | ||
<col style="width: 34%" /> | ||
<col style="width: 34%" /> | ||
</colgroup> | ||
<thead> | ||
<tr class="header"> | ||
<th></th> | ||
<th><strong>Type</strong></th> | ||
<th><strong>Default</strong></th> | ||
<th><strong>Details</strong></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr class="odd"> | ||
<td>fpath</td> | ||
<td></td> | ||
<td></td> | ||
<td>Path to Jupyter Notebook</td> | ||
</tr> | ||
<tr class="even"> | ||
<td>wrapper</td> | ||
<td>partial</td> | ||
<td>functools.partial(<function ft_hx at 0x7f08d34869e0>, | ||
‘main’)</td> | ||
<td>Wraps entire rendered NB, default is for pico</td> | ||
</tr> | ||
<tr class="odd"> | ||
<td>cls</td> | ||
<td>str</td> | ||
<td>container</td> | ||
<td>cls to be passed to wrapper, default is for pico</td> | ||
</tr> | ||
<tr class="even"> | ||
<td>md_cell_wrapper</td> | ||
<td>partial</td> | ||
<td>functools.partial(<function ft_hx at 0x7f08d34869e0>, | ||
‘div’)</td> | ||
<td>Wraps markdown cell</td> | ||
</tr> | ||
<tr class="odd"> | ||
<td>md_fn</td> | ||
<td>function</td> | ||
<td>render_md_cell</td> | ||
<td>md cell -> rendered html</td> | ||
</tr> | ||
<tr class="even"> | ||
<td>code_cell_wrapper</td> | ||
<td>function</td> | ||
<td>Card</td> | ||
<td>Wraps Source Code (body) + Outputs (footer)</td> | ||
</tr> | ||
<tr class="odd"> | ||
<td>cd_fn</td> | ||
<td>function</td> | ||
<td>render_code_source</td> | ||
<td>code cell -> code source rendered html</td> | ||
</tr> | ||
<tr class="even"> | ||
<td>out_fn</td> | ||
<td>function</td> | ||
<td>render_code_output</td> | ||
<td>code cell -> code output rendered html</td> | ||
</tr> | ||
<tr class="odd"> | ||
<td>kwargs</td> | ||
<td></td> | ||
<td></td> | ||
<td></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
## Todo | ||
|
||
- Quarto stuff rendered? | ||
- Implement default for Markdown based on FastHTML’s default |
Oops, something went wrong.