Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JakobAsslaender opened this issue Sep 9, 2024 · 1 comment
Open

Comments

@JakobAsslaender
Copy link

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!

@fredrikekre
Copy link
Owner

You can disable cross reference checking when building locally with this kwarg

warnonly = is_ci ? false : [:cross_references]

to makedocs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants