sphinx icon indicating copy to clipboard operation
sphinx copied to clipboard

Allow anchors to wrap anywhere

Open NadavTasher opened this issue 2 months ago • 5 comments

Purpose

Anchors with very long unbreakable links cause pages to be horizontally scrollable on mobile. Fix this by allowing anchors to break anywhere.

This was observed on the following page: https://docs.kernel.org/filesystems/ramfs-rootfs-initramfs.html#why-cpio-rather-than-tar

Screenshots

Without the proposed changes: image

With the proposed changes: image

NadavTasher avatar Oct 25 '25 16:10 NadavTasher

I've used this before:

    overflow-wrap: break-word;

Can anyone tell which one is better in this case?

mgeier avatar Oct 26 '25 15:10 mgeier

From https://stackoverflow.com/questions/17259916/difference-between-overflow-wrap-and-word-break, it seems as though word-break is actually deprecated. I'll update my PR to use overflow-wrap.

NadavTasher avatar Oct 27 '25 12:10 NadavTasher

it seems as though word-break is actually deprecated.

I'm not an expert, but AFAIU your SO link (and https://developer.mozilla.org/en-US/docs/Web/CSS/word-break), only word-break: break-word; is deprecated but word-break: break-all; should be fine.

mgeier avatar Oct 27 '25 19:10 mgeier

I'm not an expert, but AFAIU your SO link (and https://developer.mozilla.org/en-US/docs/Web/CSS/word-break), only word-break: break-word; is deprecated but word-break: break-all; should be fine.

I changed it to overflow-wrap, as that seems to be the go-to in other places. I tested it and it works exactly the same.

NadavTasher avatar Oct 27 '25 23:10 NadavTasher

@AA-Turner Can you take a look at this?

NadavTasher avatar Nov 07 '25 19:11 NadavTasher