# Can documenter insert (embed) examples from a file to a page code block?

**URL:** https://discourse.julialang.org/t/can-documenter-insert-embed-examples-from-a-file-to-a-page-code-block/56898
**Category:** Tooling
**Tags:** documenter
**Created:** [March 10, 2021, 4:13pm UTC](https://discourse.julialang.org/t/can-documenter-insert-embed-examples-from-a-file-to-a-page-code-block/56898 "2021-03-10T16:13:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)
#### Post date: [March 10, 2021, 4:13pm UTC](https://discourse.julialang.org/t/can-documenter-insert-embed-examples-from-a-file-to-a-page-code-block/56898/1 "2021-03-10T16:13:58Z")

</div>

I would like to add some full-feature examples on my package documentation, but rather than copy/pasting in the example block I would like to keep each example on its own file.

In general markdown [this is not possible](https://stackoverflow.com/questions/10280902/how-to-embed-code-from-repo-in-github-markdown), but maybe using Documenter it is ?? 🙂

---

<div class="post-metadata">

### Author: ![mortenpi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mortenpi/32/158_2.png) [@mortenpi](https://discourse.julialang.org/u/mortenpi)
#### Post date: [March 11, 2021, 12:33am UTC](https://discourse.julialang.org/t/can-documenter-insert-embed-examples-from-a-file-to-a-page-code-block/56898/2 "2021-03-11T00:33:51Z")

</div>

There is [an open issue for this kind of feature](https://github.com/JuliaDocs/Documenter.jl/issues/499). You have a few options for a workaround though:

1. As [suggested by Kristoffer](https://github.com/JuliaDocs/Documenter.jl/issues/499#issuecomment-346969458), you can do something like

2. Another option is to use [Literate.jl](https://github.com/fredrikekre/Literate.jl) to convert the script into a `.md` file for Documenter. You can look at how `examples/example.jl` is included in the Literate docs (basically, you just need to add a `Literate.markdown` call to `docs/make.jl`.

3. Finally, you can always do your own pre-processing or generation of the `.md` files in `docs/make.jl`.

---

<div class="post-metadata">

### Author: ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)
#### Post date: [March 11, 2021, 5:28am UTC](https://discourse.julialang.org/t/can-documenter-insert-embed-examples-from-a-file-to-a-page-code-block/56898/3 "2021-03-11T05:28:07Z")

</div>

JuMP embeds all of our examples with literate. It works excellently.

See  
[https://jump.dev/JuMP.jl/dev/tutorials/Getting%20started/getting\_started\_with\_JuMP/](https://jump.dev/JuMP.jl/dev/tutorials/Getting%20started/getting_started_with_JuMP/)

There is a link at the bottom to the source file
