Skip to content

[Bug] @__BINDER_ROOT_URL__ = <unknown> throws an error locally #250

Open
@JakobAsslaender

Description

Hi,

as of lately, I get an error when running Literate + Documenter locally. The macro @__BINDER_ROOT_URL__ is iterpreted as <unknown>, which seems to throw an error in the latest Documenter. As a MWE, I can just run the Literate.jl documentation locally:

Literate.jl % julia --project=docs docs/make.jl 
[ Info: generating markdown page from `~/Desktop/Literate.jl/examples/example.jl`
[ Info: writing result to `~/Desktop/Literate.jl/docs/src/generated/example.md`
[ Info: generating notebook from `~/Desktop/Literate.jl/examples/example.jl`
[ Info: executing notebook `example.ipynb`
[ Info: writing result to `~/Desktop/Literate.jl/docs/src/generated/example.ipynb`
[ Info: generating plain script file from `~/Desktop/Literate.jl/examples/example.jl`
[ Info: writing result to `~/Desktop/Literate.jl/docs/src/generated/example.jl`
[ Info: generating markdown page from `~/Desktop/Literate.jl/docs/src/outputformats.jl`
[ Info: writing result to `~/Desktop/Literate.jl/docs/src/generated/name.md`
[ Info: generating notebook from `~/Desktop/Literate.jl/docs/src/outputformats.jl`
[ Info: executing notebook `notebook.ipynb`
[ Info: writing result to `~/Desktop/Literate.jl/docs/src/generated/notebook.ipynb`
[ Info: generating plain script file from `~/Desktop/Literate.jl/docs/src/outputformats.jl`
[ Info: writing result to `~/Desktop/Literate.jl/docs/src/generated/outputformats.jl`
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
┌ Error: invalid local link/image: file does not exist in src/generated/example.md
│   link =@ast MarkdownAST.Link("<unknown>/generated/example.ipynb", "") do
│      MarkdownAST.Image("https://mybinder.org/badge_logo.svg", "") do
│        MarkdownAST.Text("")
│      endend
│    
└ @ Documenter ~/.julia/packages/Documenter/qoyeC/src/utilities/utilities.jl:44
┌ Error: invalid local link/image: file does not exist in src/generated/example.md
│   link =@ast MarkdownAST.Link("<unknown>/generated/example.ipynb", "") do
│      MarkdownAST.Image("https://img.shields.io/badge/show-nbviewer-579ACA.svg", "") do
│        MarkdownAST.Text("")
│      endend
│    
└ @ Documenter ~/.julia/packages/Documenter/qoyeC/src/utilities/utilities.jl:44
┌ Error: invalid local link/image: file does not exist in src/generated/example.md
│   link =@ast MarkdownAST.Link("<unknown>/examples/example.jl", "") do
│      MarkdownAST.Code("example.jl")
│    end
│    
└ @ Documenter ~/.julia/packages/Documenter/qoyeC/src/utilities/utilities.jl:44
┌ Error: invalid local link/image: file does not exist in src/generated/example.md
│   link =@ast MarkdownAST.Link("<unknown>/generated/example.ipynb", "") do
│      MarkdownAST.Code("example.ipynb")
│    end
│    
└ @ Documenter ~/.julia/packages/Documenter/qoyeC/src/utilities/utilities.jl:44
┌ Error: invalid local link/image: file does not exist in src/generated/example.md
│   link =@ast MarkdownAST.Link("<unknown>/generated/example.ipynb", "") do
│      MarkdownAST.Code("example.ipynb")
│    end
│    
└ @ Documenter ~/.julia/packages/Documenter/qoyeC/src/utilities/utilities.jl:44
┌ Error: invalid local link/image: file does not exist in src/generated/example.md
│   link =@ast MarkdownAST.Link("<unknown>/examples/example.jl", "") do
│      MarkdownAST.Text("source file")
│    end
│    
└ @ Documenter ~/.julia/packages/Documenter/qoyeC/src/utilities/utilities.jl:44

When I set the binder URL to an actual URL:
Literate.markdown(file_path, OUTPUT; binder_root_url="https://mybinder.org/v2/gh/")
things work. But of course, it would be great if, locally, a dummy URL could be inserted that does not throw an error, while being able to use the automated insertion on GitHub.

Would it maybe be a fix to replace <unknown> with a URL in this line?

Literate.jl/src/Literate.jl

Lines 219 to 220 in 5c9beaa

push!(repls, "@__BINDER_ROOT_URL__" => get(config, "binder_root_url", "<unknown>"))
end

Thanks for looking into this!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions