JuliaDocs / DemoCards.jl

Let's focus on writing demos
MIT License
65 stars 14 forks source link

Support Pluto.jl notebooks for demos? #120

Closed Dsantra92 closed 1 year ago

Dsantra92 commented 1 year ago

It would be nice to have DemoCards working with Pluto.jl. I was planning to use it for demos in GraphNeuralNetworks.jl.

ps: I will be happy to contribute to the feature (if approved).

johnnychen94 commented 1 year ago

There are two ways to bring Pluto into this package:

The first solution requires Litearte support (https://github.com/fredrikekre/Literate.jl/pull/120). For the second solution, is there a stable Pluto API to export HTML (or markdown files) here? I don't use Pluto much so don't know if this is doable.

Edit: my Julia service time is starting to be more limited so I'll be more focused on JuliaImages-related stuff. Thus it would be fantastic if you find out a way to support this and open a PR.

Dsantra92 commented 1 year ago

The 2nd option looks doable, rendering in Pluto is doable but I need to know about this package more. Let's see if I can find a solution.

johnnychen94 commented 1 year ago

You can maybe start with a runtime dispatch to generate a new type PlutoCard: https://github.com/JuliaDocs/DemoCards.jl/blob/e2fc229fb4880fd90c9775698fa592d2737a3c37/src/types/card.jl#L20-L30 Then add the necessary save_democards function https://github.com/JuliaDocs/DemoCards.jl/blob/e2fc229fb4880fd90c9775698fa592d2737a3c37/src/types/julia.jl#L134-L142

Some special handling might be needed to directly insert the HTML into the template without passing it to Documenter's HTML generation. For instance, DemoCards uses Documenter's [](@ref id) syntax to generate the reflink. For Pluto notebook, we might need a conditional check to insert the relative path instead. (The id property is useless as well)

Dsantra92 commented 1 year ago

Thanks for the headstart!!