Skip to content

"overflow-wrap: anywhere" is problematic in table cell code blocks #1321

@boneskull

Description

@boneskull

What version of starlight are you using?

0.15.1

What version of astro are you using?

4.0.8

What package manager are you using?

npm

What operating system are you using?

mac

What browser are you using?

chromium-based

Describe the Bug

There's a style somewhere that sets overflow-wrap: anywhere -- probably across the markdown content. But this is problematic when the code block lives in a table cell and the code block is particularly short:

image

Source of the above:

| Name      | Type      | Default | Description                                                                                  |
| --------- | --------- | ------- | -------------------------------------------------------------------------------------------- |
| `types`   | `boolean` | `true`  | Check the file referenced by the conditional `types` export has a `.d.ts` extension          |
| `require` | `boolean` | `true`  | Check the file referenced by the conditional `require` export references a CommonJS script   |
| `import`  | `boolean` | `true`  | Check the file referenced by the conditional `import` export references an ECMAScript module |
| `order`   | `boolean` | `true`  | Check the conditional `default` export is the _last_ field in its object                     |
| `glob`    | `boolean` | `true`  | If `false`, disallow glob patterns in the `exports` field                                    |

Suggestion:

Something like

.sl-markdown-content :is(th, td):not(:where(.not-content *)) > code {
  overflow-wrap: normal;
}

...and whatever CSS is needed to except pre > code from the rule.

Link to Minimal Reproducible Example

n/a

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions