Adding a documentation may look like a daunting task but once you get the hang of it, it’s actually quite simple. Don’t hesitate to ask for help in Gitter if you ever get stuck.
Note: please read the contributing guidelines before submitting a new documentation.
Docs::UrlScraper
or Docs::FileScraper
in the lib/docs/scrapers/
directory. Its name should be the PascalCase equivalent of the filename (e.g. my_doc
→ MyDoc
)thor docs:list
.lib/docs/filters/[my_doc]/
directory and add them to the class’s filter stacks. You may create any number of filters but will need at least the following two:
CleanHtml
filter whose task is to clean the HTML markup (e.g. adding id
attributes to headings) and remove everything superfluous and/or nonessential.Entries
filter whose task is to determine the pages’ metadata (the list of entries, each with a name, type and path).
The Filter Reference page has all the details about filters.thor docs:page [my_doc] [path]
command, check that the scraper works properly. Files will appear in the public/docs/[my_doc]/
directory (but not inside the app as the command doesn’t touch the index). path
in this case refers to either the remote path (if using UrlScraper
) or the local path (if using FileScraper
).thor docs:generate [my_doc] --force
command. Additionally, you can use the --verbose
option to see which files are being created/updated/deleted (useful to see what changed since the last run), and the --debug
option to see which URLs are being requested and added to the queue (useful to pin down which page adds unwanted URLs to the queue).assets/stylesheets/pages/
directory and import it in both application.css.scss
AND application-dark.css.scss
. Both the file and CSS class should be named _[type]
where [type] is equal to the scraper’s type
attribute (documentations with the same type share the same custom CSS and JS). Setting the type to simple
will apply the general styling rules in assets/stylesheets/pages/_simple.scss
, which can be used for documentations where little to no CSS changes are needed.assets/javascripts/views/pages/
directory (take a look at the other files to see how it works).public/icons/docs/[my_doc]/
directory, in both 16x16 and 32x32-pixels formats. The icon spritesheet is automatically generated when you (re)start your local DevDocs instance.assets/javascripts/templates/pages/about_tmpl.coffee
. This is the data shown in the table on the about page, and is ordered alphabetically. Simply copying an existing item, placing it in the right slot and updating the values to match the new scraper will do the job.thor updates:check [my_doc]
shows the correct latest version.If the documentation includes more than a few hundreds pages and is available for download, try to scrape it locally (e.g. using FileScraper
). It’ll make the development process much faster and avoids putting too much load on the source site. (It’s not a problem if your scraper is coupled to your local setup, just explain how it works in your pull request.)
Finally, try to document your scraper and filters’ behavior as much as possible using comments (e.g. why some URLs are ignored, HTML markup removed, metadata that way, etc.). It’ll make updating the documentation much easier.