JuliaBooks / Books.jl

Create books with Julia
https://huijzer.xyz/Books.jl/
Other
270 stars 18 forks source link

Add Jupyter Notebook support? #316

Open NeroBlackstone opened 6 months ago

NeroBlackstone commented 6 months ago

For some time-consuming code, Jupyter Notebook could save single run results, instead of running the codes in markdown every time. So I think it's meaningful to support Jupyter Nootbook

rikhuijzer commented 6 months ago

Jupyter Notebooks encourage more "script"-style projects whereas Books.jl aims to have a proper software package and then call outputs from there. To avoid re-running long running computations, you could use gen(path, block_number; ...) to call only specific blocks. To automatically re-evaluate blocks after you change code, you can use entr_gen(path, block_number; ...). See the docstrings of these functions for more information.

NeroBlackstone commented 5 months ago

Does books.jl also support “script-style” projects?

It seems that Books.jl cannot do the following two things:

  1. Define variables and use them in markdown context.
  2. Directly display code blocks itself and the output of code blocks, like Jupyter Notebook. Instead of writing separate statements for displaying code blocks and executing code blocks.

As you said:

"Books.jl aims to have a proper software package and then call outputs from there."

But I think "script-style" can make writing more natural and help us port some Jupyter Notebooks with julia kernel, which will make Books.jl a direct replacement for Jupyter Book (if books are written in julia language)

I don't know if this feature is within the goals of Books.jl or there is interest in implementing it, but I think it makes a lot of sense. I think there are two options:

  1. Directly make Markdown interactive, variables and functions can be defined and called(I prefer this)
  2. Add Jupyter Notebook support
NeroBlackstone commented 5 months ago

It seems that Books.jl cannot do the following two things:

Define variables and use them in markdown context. Directly display code blocks itself and the output of code blocks, like Jupyter Notebook. Instead of writing separate statements > for displaying code blocks and executing code blocks.

Sorry, after checking JuliaDataScience ,I found that this can be done

But I think something like this a little cumbersome:

s = """
    name = "Julia"
    age = 9
    """
scob(s)

I think we still need an interactive solution, It looks like there is already a ready-made solution: PlutoStaticHTML.jl

But I still haven't figured out How to generate html and pdf from Pluto Notebook with numbering of sections, like a book.