{"id":18656562,"url":"https://github.com/zendesk/double_doc","last_synced_at":"2025-04-09T15:05:25.275Z","repository":{"id":2493850,"uuid":"3468022","full_name":"zendesk/double_doc","owner":"zendesk","description":"Write documentation with your code, to keep them in sync, ideal for public API docs.","archived":false,"fork":false,"pushed_at":"2025-01-17T15:06:38.000Z","size":3980,"stargazers_count":17,"open_issues_count":1,"forks_count":5,"subscribers_count":419,"default_branch":"main","last_synced_at":"2025-04-09T15:05:21.637Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zendesk.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-02-17T07:43:50.000Z","updated_at":"2025-01-17T15:06:38.000Z","dependencies_parsed_at":"2024-12-24T21:08:21.078Z","dependency_job_id":"36ec6c99-bee7-4f2c-bdc2-f7896d25725d","html_url":"https://github.com/zendesk/double_doc","commit_stats":{"total_commits":130,"total_committers":10,"mean_commits":13.0,"dds":"0.39230769230769236","last_synced_commit":"db48a6e4880d042bf55d470ddeedd2301384d087"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fdouble_doc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fdouble_doc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fdouble_doc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fdouble_doc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zendesk","download_url":"https://codeload.github.com/zendesk/double_doc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055284,"owners_count":21040157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T07:24:01.804Z","updated_at":"2025-04-09T15:05:25.258Z","avatar_url":"https://github.com/zendesk.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"## DoubleDoc 2.0\n\n[![CI Status](https://github.com/zendesk/double_doc/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/zendesk/double_doc/actions/workflows/ci.yml)\n\n\u003c!-- only modify doc/readme.md and not Readme.md --\u003e\n\nWrite documentation with your code, to keep them in sync, ideal for public API docs.\n\nThis document was generated using DoubleDoc from [doc/readme.md](doc/readme.md), and the source of this project is a great source for how to use DoubleDoc.\n\n### Documentation Format\nWrite documentation in markdown right in source code files by double commenting it:\n```ruby\nclass User \u003c ActiveRecord::Base\n  ## ```js\n  ## {\n  ##   \"id\":   1,\n  ##   \"name\": \"Mick Staugaard\"\n  ## }\n  ## ```\n  def as_json\n    # this comment will not be included in the documentation\n    # as it only has a single # character\n    super(only: [:id, :name])\n  end\nend\n\nclass UsersController \u003c ApplicationController\n  ## ### Getting a User\n  ## `GET /users/{id}.json`\n  ##\n  ## #### Format\n  ## @import app/models/user.rb\n  def show\n    render json: User.find(params[:id])\n  end\nend\n```\n\nThen write a markdown document about User API:\n\n    ## Users\n    Access users by using our REST API, blah blah blah...\n\n    @import app/controllers/users_controller.rb\n\nAnd DoubleDoc will generate this markdown document:\n\n    ## Users\n    Access users in by using our REST API, blah blah blah...\n\n    ### Getting a User\n    `GET /users/{id}.json`\n\n    #### Format\n    ```js\n    {\n      \"id\":   1,\n      \"name\": \"Mick Staugaard\"\n    }\n    ```\n\n### Rake Task\nGenerate documentation by telling DoubleDoc what the input files are, and where the output should go.\nIn the example, `double_doc` is picked to avoid conflicts with the `doc` rake task in rails.\n\n```ruby\nrequire 'double_doc'\n\nDoubleDoc::Task.new(\n  :double_doc,\n  sources:          'doc/source/*.md',\n  md_destination:   'doc/generated',\n  html_destination: 'site'\n)\n```\n\nThe available options are:\n\n| name                 | Description\n| -------------------- | -----------\n| __sources__          | __Required__. Documentation source directory (string or array of strings).\n| __md_destination__   | __Required__. Directory where the generated markdown files should go.\n| __html_destination__ | Where a pretty HTML version of the documentation should go.\n| __html_template__    | Custom ERB template for HTML rendering, see default template for inspiration (templates/default.html.erb).\n| __html_renderer__    | Custom html rendered, defaults to `DoubleDoc::HtmlRenderer`.\n| __html_css__         | Custom CSS document path.\n| __title__            | Title for generated HTML, defaults to \"Documentation\".\nTo generate a README.md for github, write documentation in doc/README.md and put this in the Rakefile:\n\n```ruby\nrequire 'double_doc'\n\nDoubleDoc::Task.new(:double_doc, sources: 'doc/README.md', md_destination: '.')\n```\n\nThen run `rake double_doc`, which will generate a `readme.md` in the root of the project.\n\nIf a gh-pages branch exists, run `rake doc:publish` to generate html documentation and push it to your github pages.\n\n### Notes\n - Tested on ruby 3.0+\n - Does not work on jruby because of its dependency on redcarpet.\n\n### Release\n\nAfter merging your changes:\n1. Create a PR with a version bump and updated changelog.\n2. After that PR gets merged, create a new tag (by running `gem_push=no rake release` or via Github releases).\n3. This will trigger the publishing workflow—[approve it in Github Actions](https://github.com/zendesk/double_doc/actions/workflows/publish.yml)).\n\n### TODO\n* Support for directory structures\n* Documentation for the Guard\n* Add support for extracting documentation from JavaScript files\n\n### License\n#### The MIT License\n\nCopyright © 2012 [Mick Staugaard](mailto:mick@staugaard.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS,” WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzendesk%2Fdouble_doc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzendesk%2Fdouble_doc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzendesk%2Fdouble_doc/lists"}