Skip to content

AnswerDotAI/nb2fasthtml

Repository files navigation

nb2fasthtml

This file will become your README and also the index of your documentation.

Developer Guide

If you are new to using nbdev here are some useful pointers to get you started.

Install nb2fasthtml in Development mode

# 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

Usage

Installation

Install latest from the GitHub repository:

$ pip install git+https://github.com/AnswerDotAI/nb2fasthtml.git

Documentation

Documentation can be found hosted on this GitHub repository’s pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.

How to use

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages