Dactyl is a Julia module that enables interactive documentation within the Julia REPL. It allows you to define code blocks and automatically update an HTML page with the results of those blocks. It can be used to create dynamic tutorials, notebooks, or interactive code documentation.
- Automatic block detection: Dactyl automatically detects the start and end of code blocks in the REPL.
- Block parsing: The module parses code blocks and extracts relevant information.
- Page updating: Dactyl updates an HTML page with the parsed code blocks and their results.
- Plot rendering: Dactyl supports rendering of plots within code blocks.
- Interactive browsing: The Surf web browser can be automatically reloaded to reflect the updated HTML page.
To use Dactyl, follow these steps:
- Install the necessary packages by running
] add RecipesBase Logging Mustache Hyperscript
. - Include the Dactyl module in your code:
using Dactyl
. - Call the
start_dactyl()
function to initialize the Dactyl module for interactive documentation in the REPL. - Define a
DactylPage
object to represent the documentation page. - Code normally, using the predifined code separators (
#% Nblock
for start and#@
for end)
using Dactyl
# Step 3: Initialize Dactyl
start_dactyl()
# Step 4: Define a DactylPage object
page = DactylPage("My Documentation")
# Step 5: Code normally, using the predifined code separators
#% 1
prompt = "Hello world"
new_world = "very small asteroid orbiting around Jupiter"
replace(prompt, "world"=>new_world)
#@
#% 2
using Plots
x = rand(100)
y = rand(100)
scatter(x, y)
#@
# Step 4: Evaluate those lines in the REPL using [vim-slime](https://github.com/stebett/vim-slime-dactyl) (slightly modified to include the separator)
start_dactyl()
: Initializes the Dactyl module for interactive documentation.detect_block(ans)
: Detects code blocks, parses them, and updates the DactylPage object and HTML file.
For more details on the functions and their usage, please refer to the module code.
Check out the examples/
directory for an example usage of the Dactyl module.
Dactyl is released under the MIT License.
- Proper display of Dataframes, matrix and vector
- Compute html only for the block being computed
- write css only once
- When you reopen a page, automatically refill block structures with the html already written
- [] Make Plots, DataFrames etc optional dependencies
- [] Add dispatch for Vector{Plots} where you can slides plots with an arrow button