8000 Avoid wrapping on RBS quick reference table by sambostock · Pull Request #8831 · sorbet/sorbet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Avoid wrapping on RBS quick reference table #8831

New issue
Merged
merged 1 commit into from
May 5, 2025

Conversation

sambostock
Copy link
Contributor

Motivation

The type_parameters example is long and causes line wrapping of itself, and other code snippets.

We can avoid this by switching to a multiline code block for the Sorbet column of this table (which also has the benefit of allowing us to highlight Ruby syntax).

This comes at the cost of needing to switch to an HTML table (interlaced with Markdown) which is harder to edit. However, this tradeoff is acceptable, as we should optimize for documentation readers, not for documentation authors (and LLMs can help edit the docs anyway).

Before After
image image

Test plan

This is a documentation only change, other than the Docusaurus config change, which should be covered by existing tests. I've also tried out rendering the docs, and it renders as expected (see screenshots above).

@sambostock sambostock requested a review from a team as a code owner May 5, 2025 21:50
@sambostock sambostock requested review from elliottt and removed request for a team May 5, 2025 21:50
@@ -436,7 +744,7 @@ You can also consider using [`T::Enum`](tenum.md).

### `T.let` assertions

[`T.let`](type-assertions.md#tlet) assertions can be expressed using RBS
[`T.let`](type-assertions#tlet) assertions can be expressed using RBS
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please do not remove these .md comments.

I wonder if Shopify has some sort of editor tooling which is removing these on save—I have already asked one of your colleagues to not do this, so I'll refer you to that comment for the justification

#8741 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My mistake, I didn't intend to change those!

I wonder if Shopify has some sort of editor tooling which is removing these on save—I have already asked one of your colleagues to not do this, so I'll refer you to that comment for the justification

It's possible, but Cursor may have gotten confused, as I explicitly asked it to remove the .md extensions from <a href="/docs/blah.md"> links because those didn't work when I ran the docs server locally. I should have checked the result more closely.

I'll put them back on the Markdown links. Do you know if there's a way to make it work for both GitHub and the docs website when linking around ```ruby blocks? AFAIK, I can't use [Markdown](/links) to wrap around those, and I assume Docusaurus only applies it's compatibility transformation to those 8000 links. 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

Unfortunately I think with raw HTML there's nothing we can do. We have the same shortcoming in the TypeScript <-> Sorbet Reference page.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I confirmed Docusaurus (or at least version 1.x, which is what we're using) only looks at inline and reference style Markdown links.

I've put those links back, but stuck to non-.md hrefs for the raw HTML links.

Copy link
Collaborator
@jez jez left a comment

Choose a reason for hiding this comment

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

Thanks, two requests.

The `type_parameters` example is long and causes line wrapping of
itself, and other code snippets.

We can avoid this by switching to a multiline code block for the Sorbet
column of this table (which also has the benefit of allowing us to
highlight Ruby syntax).

This comes at the cost of needing to switch to an HTML table (interlaced
with Markdown) which is harder to edit.  However, this tradeoff is
acceptable, as we should optimize for documentation readers, not for
documentation authors (and LLMs can help edit the docs anyway).
@sambostock sambostock requested a review from jez May 5, 2025 23:17
@jez jez enabled auto-merge (squash) May 5, 2025 23:17
@jez jez merged commit 5c72fd9 into sorbet:master May 5, 2025
14 checks passed
@sambostock sambostock deleted the rbs-html-table branch May 5, 2025 23:40
@sambostock sambostock changed the title Disable incorrect RBS syntax highlighting Avoid wrapping on RBS quick reference table May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0