Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with code formating in the documentation #30008

Open
MartinDelille opened this issue Dec 1, 2024 · 4 comments
Open

Issue with code formating in the documentation #30008

MartinDelille opened this issue Dec 1, 2024 · 4 comments

Comments

@MartinDelille
Copy link

Description

I noticed an issue in the code example in the documentation:

Screenshot 2024-12-01 at 22 54 36

(link: https://threejs.org/docs/index.html#manual/en/introduction/Creating-a-scene)

As you can see the code if not properly formatted like in the corresponding code: https://github.com/mrdoob/three.js/blob/dev/docs/manual/en/introduction/Creating-a-scene.html#L26-L35

I sent a specific link but it happens all over the website.

Reproduction steps

Just go to the documentation and look at a code example.

Code

N/A

Live example

Screenshots

No response

Version

r171

Device

Desktop

Browser

Firefox

OS

MacOS

@Mugen87
Copy link
Collaborator

Mugen87 commented Dec 1, 2024

We had a similar issue lately, see #29569. We actually fixed the issue by updating prettify.js but it seems it happens again in Firefox.

@mrxz
Copy link
Contributor

mrxz commented Dec 2, 2024

Able to reproduce the issue, happens quite consistently when loading a page with cache disabled (or after clearing cache/hard reloading).

Took a while to figure out what is causing it, but prettify.js determines if a <code> element is preformatted based on its computed style (prettify.js#L1650-L1659). However, under Firefox the computed style is empty when the iframe has display: none, which is the case while the inner page is still loading some resources. This behaviour seems to actually be what the CSSWG agreed upon, but it appears only Firefox behaves this way (https://bugzilla.mozilla.org/show_bug.cgi?id=1471231)

The pretty printing could be delayed, but that's not ideal since besides this there really isn't any reason to delay it. We know that the (non inline) code blocks are pre-formatted and only have to "tell" prettify.js this, but there doesn't seem to be a way to do this without making the changes to prettify.js directly.

@MartinDelille
Copy link
Author

Thanks for you detailed answer! I'll watch the documentation in another browser if it bother me.

@Mugen87
Copy link
Collaborator

Mugen87 commented Dec 2, 2024

The pretty printing could be delayed, but that's not ideal since besides this there really isn't any reason to delay it.

How about we do that just for Firefox? Modifying prettify.js is something that I would like to avoid if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants