Search code examples
firefox-addon-sdkofflinemozilla

Mozilla Add-on SDK documentation download


Is there a way to download the documentation for the Add-on SDK?

In previous versions, you could type

cfx docs

to browse a local copy, yet cfx is deprecated and the docs option was removed even before that.

https://github.com/neiesc/dochub seems like a way to go, but fails on nodejs 0.12.


Not working:

  • The last commit with the cfx docs command is 97d77223. The documentation is in markdown files in the repository, and thus, obsolete.

  • The Add-on SDK does not contain enough comments to generate the documentation from it. There is f.ex. no info about page-mod in its files in lib/sdk.

  • http://devdocs.io/ has a proposal to import, but it is in the middle of the proposals vote-wise.


Solution

  • The problem with the naive wget approach is the stylesheet, which has a URL with a ? and is probably not recognized by wget. To fix, after

    1. downloading all docs via

      wget --continue --adjust-extension --recursive --page-requisites --convert-links --level=inf --no-parent --wait=1 'https://developer.mozilla.org/en-US/Add-ons/SDK'
      
    2. download the stylesheet manually

      wget https://developer.cdn.mozilla.net/media/css/mdn-min.css?build=0e7ce0f
      
    3. rename

      mv mdn-min.css?build=0e7ce0f mdn-min.css
      
    4. copy to every sub-directory

      find . -type d -exec cp mdn-min.css {} \;
      
    5. and alter all files to use the local stylesheet:

      find . -type f -exec sed -i 's!https\:\/\/developer\.cdn\.mozilla\.net\/media\/css\/mdn-min.css!mdn-min.css!g' {} \;