# Pluto for literate programming

**URL:** <https://discourse.julialang.org/t/pluto-for-literate-programming/132499>\
**Category:** General Usage\
**Tags:** pluto\
**Created:** [September 18, 2025, 9:18pm UTC](https://discourse.julialang.org/t/pluto-for-literate-programming/132499 "2025-09-18T21:18:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bertschi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bertschi/32/33462_2.png) [@bertschi](https://discourse.julialang.org/u/bertschi)\
**Post date:** [September 18, 2025, 9:18pm UTC](https://discourse.julialang.org/t/pluto-for-literate-programming/132499/1 "2025-09-18T21:18:05Z")

</div>

Just realized that Pluto can be turned into a web style literate programming tool with the help of a simple macro. Pluto’s dependency tracking already allows cells to be ordered as the programmer likes instead of what the program flow demands. The missing piece is to name code snippets to be inserted and possibly reused in other places.

```julia
macro snippet(name, expr)
    :(macro $(esc(name))() esc($(Expr(:quote, expr))) end)
end

```

The screenshot below shows (a completely made-up and trivial) example for a literate notebook:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/a/0a22dcccbfe675976ab0807887fbdcc4109fef20.png)
