在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
DevDocs — API Documentation BrowserDevDocs combines multiple developer documentations in a clean and organized web UI with instant search, offline support, mobile version, dark theme, keyboard shortcuts, and more. DevDocs was created by Thibaut Courouble and is operated by freeCodeCamp. We are currently searching for maintainersPlease reach out to the community on Gitter if you would like to join the team! Keep track of development news: Table of Contents: Quick Start · Vision · App · Scraper · Commands · Contributing · Documentation · Related Projects · License · Questions? Quick StartUnless you wish to contribute to the project, we recommend using the hosted version at devdocs.io. It's up-to-date and works offline out-of-the-box. DevDocs is made of two pieces: a Ruby scraper that generates the documentation and metadata, and a JavaScript app powered by a small Sinatra app. DevDocs requires Ruby 2.7.4, libcurl, and a JavaScript runtime supported by ExecJS (included in OS X and Windows; Node.js on Linux). Once you have these installed, run the following commands: git clone https://github.com/freeCodeCamp/devdocs.git && cd devdocsgem install bundlerbundle installbundle exec thor docs:download --defaultbundle exec rackup Finally, point your browser at localhost:9292 (the first request will take a few seconds to compile the assets). You're all set. The Note: there is currently no update mechanism other than Alternatively, DevDocs may be started as a Docker container: # First, build the imagegit clone https://github.com/freeCodeCamp/devdocs.git && cd devdocsdocker build -t thibaut/devdocs .# Finally, start a DevDocs container (access http://localhost:9292)docker run --name devdocs -d -p 9292:9292 thibaut/devdocs VisionDevDocs aims to make reading and searching reference documentation fast, easy and enjoyable. The app's main goals are to: keep load times as short as possible; improve the quality, speed, and order of search results; maximize the use of caching and other performance optimizations; maintain a clean and readable user interface; be fully functional offline; support full keyboard navigation; reduce “context switch” by using a consistent typography and design across all documentations; reduce clutter by focusing on a specific category of content (API/reference) and indexing only the minimum useful to most developers. Note: DevDocs is neither a programming guide nor a search engine. All our content is pulled from third-party sources and the project doesn't intend to compete with full-text search engines. Its backbone is metadata; each piece of content is identified by a unique, "obvious" and short string. Tutorials, guides and other content that don't meet this requirement are outside the scope of the project. AppThe web app is all client-side JavaScript, written in CoffeeScript, and powered by a small Sinatra/Sprockets application. It relies on files generated by the scraper. Many of the code's design decisions were driven by the fact that the app uses XHR to load content directly into the main frame. This includes stripping the original documents of most of their HTML markup (e.g. scripts and stylesheets) to avoid polluting the main frame, and prefixing all CSS class names with an underscore to prevent conflicts. Another driving factor is performance and the fact that everything happens in the browser. A service worker (which comes with its own set of constraints) and DevDocs being a developer tool, the browser requirements are high:
This allows the code to take advantage of the latest DOM and HTML5 APIs and make developing DevDocs a lot more fun! ScraperThe scraper is responsible for generating the documentation and index files (metadata) used by the app. It's written in Ruby under the There are currently two kinds of scrapers: Modifications made to each document include:
These modifications are applied via a set of filters using the HTML::Pipeline library. Each scraper includes filters specific to itself, one of which is tasked with figuring out the pages' metadata. The end result is a set of normalized HTML partials and two JSON files (index + offline data). Because the index files are loaded separately by the app following the user's preferences, the scraper also creates a JSON manifest file containing information about the documentations currently available on the system (such as their name, version, update date, etc.). More information about scrapers and filters is available in the Available CommandsThe command-line interface uses Thor. To see all commands and options, run # Serverrackup # Start the server (ctrl+c to stop)rackup --help # List server options# Docsthor docs:list # List available documentationsthor docs:download # Download one or more documentationsthor docs:manifest # Create the manifest file used by the appthor docs:generate # Generate/scrape a documentationthor docs:page # Generate/scrape a documentation pagethor docs:package # Package a documentation for use with docs:downloadthor docs:clean # Delete documentation packages# Consolethor console # Start a REPLthor console:docs # Start a REPL in the "Docs" module# Tests can be run quickly from within the console using the "test" command. # Run "help test" for usage instructions.thor test:all # Run all teststhor test:docs # Run "Docs" teststhor test:app # Run "App" tests# Assetsthor assets:compile # Compile assets (not required in development mode)thor assets:clean # Clean old assets If multiple versions of Ruby are installed on your system, commands must be run through ContributingContributions are welcome. Please read the contributing guidelines. DocumentationRelated ProjectsMade something cool? Feel free to open a PR to add a new row to this table!
Copyright / LicenseCopyright 2013–2021 Thibaut Courouble and other contributors This software is licensed under the terms of the Mozilla Public License v2.0. See the COPYRIGHT and LICENSE files. Please do not use the name DevDocs to endorse or promote products derived from this software without the maintainers' permission, except as may be necessary to comply with the notice/attribution requirements. We also wish that any documentation file generated using this software be attributed to DevDocs. Let's be fair to all contributors by giving credit where credit's due. Thanks! Questions?If you have any questions, please feel free to ask them on the contributor chat room on Gitter. |
请发表评论