This file will become your README and also the index of your documentation.
If you are new to using nbdev
here are some useful pointers to get you
started.
# make sure nb2fasthtml package is installed in development mode
$ pip install -e .
# make changes under nbs/ directory
# ...
# compile to have changes apply to nb2fasthtml
$ nbdev_prepare
Install latest from the GitHub repository:
$ pip install git+https://github.com/AnswerDotAI/nb2fasthtml.git
Documentation can be found hosted on this GitHub repository’s pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.
Call a Jupyter notebook with the nb2classic.core.render_nb
function. It will convert the notebook into FT Components. You will need to have the MarkdownJS()
and HighlightJS()
set in the FastHTML hdrs.
Here's an example that uses demo.ipynb
, which is in the root of this project.
from nb2fasthtml.core import *
from fasthtml.common import *
hdrs = [
MarkdownJS(),
HighlightJS(langs=['python', 'javascript', 'html', 'css',]),
]
app, rt = fast_app(hdrs=hdrs)
@rt
def index():
return render_nb('demo.ipynb')
serve()
The render_nb()
function can be configured to work with other layout libraries such as fh-frankenui.