# Literate scripts within Documenter cause LiveServer loop

**URL:** https://discourse.julialang.org/t/literate-scripts-within-documenter-cause-liveserver-loop/63319
**Category:** General Usage
**Tags:** documentation, literate-programming
**Created:** [June 21, 2021, 6:38pm UTC](https://discourse.julialang.org/t/literate-scripts-within-documenter-cause-liveserver-loop/63319 "2021-06-21T18:38:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![cadojo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cadojo/32/25328_2.png) [@cadojo](https://discourse.julialang.org/u/cadojo)
#### Post date: [June 21, 2021, 6:38pm UTC](https://discourse.julialang.org/t/literate-scripts-within-documenter-cause-liveserver-loop/63319/1 "2021-06-21T18:38:32Z")

</div>

I’m trying to use `Literate.markdown` to generate pages for `Documenter`. The repo is [here](https://github.com/cadojo/ControlTheoryNotes.jl). I’m using the `make.jl` code below.

```julia
using Documenter
using Literate

for file ∈ ["Chapter 1: Dynamics.jl"]
    Literate.markdown(
        joinpath(@ __DIR__ , "..", "src", file),
        joinpath(@ __DIR__ , "src", "generated")
    )
end

makedocs(
    sitename = "Control Theory Notes",
    format = Documenter.HTML(),
    authors = "Joe Carpinelli",
    pages = [
        "Introduction" => "index.md",
        "Chapter 1: Dynamics" => joinpath("generated", "Chapter 1: Dynamics.md")
    ]
)

deploydocs(
    repo = "https://github.com/cadojo/ControlTheoryNotes.jl",
    devbranch = "main"
)

```

When I then call `LiveServer.servedocs()`, the build tries and fails continuously in a loop, and I see the following error: `Warning: couldn't find file "/Users/joey/GitHub/FOSS/ControlTheoryNotes.jl/docs/src/generated/<unknown>/src/Chapter 1: Dynamics.jl" when generating URL`. I notice that `Literate` generates the following at the top of the autogenerated `markdown` file.

```julia
EditURL = "<unknown>/src/Chapter 1: Dynamics.jl"

```

Could this be the cause of the issue? I’m having trouble debugging this.

Edit: This happens even when specifying the `literate` keyword argument to `LiveServer.servedocs`.

```julia
# in ControlTheoryNotes.jl
LiveServer.servedocs(; literate = joinpath(@ __DIR__ , "..", "docs", "src", "generated"))

```

---

<div class="post-metadata">

### Author: ![Janis\_Erdmanis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/janis_erdmanis/32/10869_2.png) [@Janis\_Erdmanis](https://discourse.julialang.org/u/Janis_Erdmanis)
#### Post date: [September 2, 2024, 11:18pm UTC](https://discourse.julialang.org/t/literate-scripts-within-documenter-cause-liveserver-loop/63319/2 "2024-09-02T23:18:34Z")

</div>

I just stumbled on the same issue. The documented solution is to set `skip_dir="<generated by literate>"`. However, I found that it does not work for the use case as it is not respected when the file watcher of LiveServer.jl is set up. The solution to avoid the infinite loop I found is to clean up all generated files before starting “servedocs” since those would not be registered in the file watcher if they happen to be within the “docs/src” directory.
