Skip to content

Add RDoc documentation site for Rubydex APIs#874

Merged
st0012 merged 3 commits into
mainfrom
codex/rdoc-docs-api
Jun 26, 2026
Merged

Add RDoc documentation site for Rubydex APIs#874
st0012 merged 3 commits into
mainfrom
codex/rdoc-docs-api

Conversation

@st0012

@st0012 st0012 commented Jun 24, 2026

Copy link
Copy Markdown
Member

Problems

  • Rubydex does not have generated API documentation that can be published as a static site.
  • The native extension exposes Ruby APIs from C, but most public C-backed methods are not documented in a format RDoc can capture.

Solutions

  • Add RDoc configuration, a documentation rake task, and a GitHub Pages workflow using the current RDoc commit.
  • Include both Ruby and C extension sources in the generated site.
  • Convert public C-backed API comments to RDoc call-seq: blocks with RBS-ish return shapes.
Screenshot 2026-06-24 at 21 07 02

(The workspace_path attribute's type label is weird but it's a RDoc issue)

@st0012 st0012 force-pushed the codex/rdoc-docs-api branch from 6131fbc to dda7daf Compare June 24, 2026 19:44
Comment thread ext/rubydex/declaration.c
* unqualified_name -> String?
*
* Returns the declaration name without namespace qualification.
*/

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RDoc's C parser only recognizes this style of C comments.

Comment thread ext/rubydex/declaration.c
// Declaration#unqualified_name -> String
/*
* call-seq:
* unqualified_name -> String?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RDoc currently doesn't have a way to read RBS sigs from C files yet. So let's use call-seq for now.

@st0012 st0012 force-pushed the codex/rdoc-docs-api branch from dda7daf to 35891d3 Compare June 24, 2026 19:55
@st0012 st0012 added the documentation Improvements or additions to documentation label Jun 24, 2026
@st0012 st0012 self-assigned this Jun 24, 2026
@st0012 st0012 linked an issue Jun 24, 2026 that may be closed by this pull request
@st0012 st0012 marked this pull request as ready for review June 24, 2026 20:08
@st0012 st0012 requested a review from a team as a code owner June 24, 2026 20:08
Comment thread .github/workflows/pages.yml Outdated
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5.0.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't GH pages deploy automatically if docs is modified? Maybe something changed, but I remembered the process being a bit simpler.

For example, the Ruby LSP GH pages website just builds everything in docs and pushes a commit to a specific branch.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the branch-based deployment approach. I chose a different approach here as explained in #874 (comment)

Comment thread ext/rubydex/declaration.c Outdated
Comment thread Gemfile Outdated
Comment thread .document
@@ -0,0 +1,5 @@
README.md
CONTRIBUTING.md
docs/*.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this, we really ought to give some love to the architecture docs, which are really behind and lacking at the moment. I ended up never finishing #423

@st0012 st0012 force-pushed the codex/rdoc-docs-api branch 2 times, most recently from 3b5eedf to 3e74247 Compare June 25, 2026 20:06
@st0012 st0012 requested a review from vinistock June 25, 2026 20:11
@st0012 st0012 force-pushed the codex/rdoc-docs-api branch from 3e74247 to 890b569 Compare June 25, 2026 20:14
Comment thread .github/workflows/pages.yml Outdated
Comment thread ext/rubydex/location.c
#include "location.h"

/*
* RDoc parser workaround for https://github.com/ruby/rdoc/issues/1744:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not the best that we need to spread this in almost all of our C files. Is there already a solution in RDoc? If there is, let's create a ticket to get rid of these so we don't forget.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I asked Codex to prototype a solution but I haven't looked into it yet.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@st0012 st0012 force-pushed the codex/rdoc-docs-api branch 2 times, most recently from 2f7e79b to 98a2517 Compare June 25, 2026 21:37
@st0012 st0012 force-pushed the codex/rdoc-docs-api branch from 98a2517 to 010634e Compare June 26, 2026 11:53
@st0012 st0012 enabled auto-merge (squash) June 26, 2026 11:58
@st0012 st0012 merged commit 063eb2b into main Jun 26, 2026
36 checks passed
@st0012 st0012 deleted the codex/rdoc-docs-api branch June 26, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Ruby API documentation for Rubydex

2 participants