Ex_doc: Uncaught JS ReferenceError: sidebarNodes is not defined

Created on 18 Nov 2016  路  11Comments  路  Source: elixir-lang/ex_doc

This occurs in _assets/js/events.js_:143. None of the sidebar items are shown. I suspect _lib/ex_doc/formatter/html/templates.ex_:122 is never getting executed, but I don鈥檛 know why.

This occurs in various browsers, including Safari v9.1, Firefox 49 (MacOS), and Opera 41 (MacOS).

Most helpful comment

@milmazz yes :)

All 11 comments

@njonsson Where did you see that error? URI? Did you clean your cache first?

Yes, I removed _doc/_, ran mix docs, cleared my browser cache, and reopened _doc/index.html_. The error recurs.

@njonsson Could you please tell me which ExDoc version are you using?

I just run the following test with ExDoc from the master branch:

$ cd ~/Dev/elixir-lang/
$ rm -rf doc
$ make docs_elixir
==> elixir (compile)
==> ex_doc (elixir)
bin/elixir ../ex_doc/bin/ex_doc "Elixir" "1.4.0-dev" "lib/elixir/ebin" -m "Kernel" -u "https://github.com/elixir-lang/elixir" --source-ref "1f11071505b0af6b5c6f5293bbb7ada401dab6c5"  -o doc/elixir -n http://elixir-lang.org/docs/master/elixir/ -p http://elixir-lang.org/docs.html -f "html" -e "lib/elixir/pages/Behaviours.md" -e "lib/elixir/pages/Guards.md" -e "lib/elixir/pages/Naming Conventions.md" -e "lib/elixir/pages/Operators.md" -e "lib/elixir/pages/Typespecs.md" -e "lib/elixir/pages/Writing Documentation.md"
$ open doc/elixir/index.html

screen shot 2016-11-17 at 10 56 00 pm

Tested on:

  • Chrome (Version 54.0 )
  • Safari 10.0.1

I am using ExDoc v0.14.3.

I have more information on the potential source of the problem. My _mix.exs_ contains ExDoc options in the def project do block. When I remove these options, the generated docs have no JavaScript errors. Note that the referenced files, _README.md_, _License.md_, and _History.md_, all exist in the root of my project.

docs: [extras: ["README.md":  [filename: "about",
                               title: "About my project"],
                "License.md": [filename: "license",
                               title: "Project license"],
                "History.md": [filename: "history",
                               title: "Project history"]]]

@njonsson could you please push a small project to github that reproduces the error? It would help us a lot on fixing it. :)

Nevermind, I can reproduce it on Elixir source: http://elixir-lang.org/docs/master/elixir/behaviours.html#full-list :)

@josevalim The issue is that we create first the extra pages... and then the sidebar_items-<rev>.js. So, when you create an extra page... head_template.eex returns nil :(

@josevalim Are you working on this?

@milmazz yes :)

Fixed in master. It also allowed us to remove the duplication between epub/html formatters in regards to extra handling.

Was this page helpful?
0 / 5 - 0 ratings