Skip to content

Inconsistent trailing newlines in codeblocks#528

Merged
its-miroma merged 11 commits intoFabricMC:mainfrom
Wind292:trailing-newline
Mar 16, 2026
Merged

Inconsistent trailing newlines in codeblocks#528
its-miroma merged 11 commits intoFabricMC:mainfrom
Wind292:trailing-newline

Conversation

@Wind292
Copy link
Copy Markdown
Contributor

@Wind292 Wind292 commented Mar 15, 2026

I noticed that some of the codeblocks have a trailing newline while most others don't. This extra newline also makes the codeblock slightly scrollable, which can be annoying if your mouse happens to be on a codeblock. I applied a fix on the items category, should I go through and fix all of them? or is this intentional for some reason?

See the third codeblock at https://docs.fabricmc.net/develop/items/first-item. There are many more besides this one example. Notice the scroll bar and the last line having a line number but it just being an empty newline.

image

after fix

image

@Wind292 Wind292 requested review from a team as code owners March 15, 2026 04:57
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 15, 2026

Deploy Preview for nimble-elf-d9d491 ready!

Name Link
🔨 Latest commit d3a1a3a
🔍 Latest deploy log https://app.netlify.com/projects/nimble-elf-d9d491/deploys/69b866188d516b0008dd631d
😎 Deploy Preview https://deploy-preview-528--nimble-elf-d9d491.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Wind292 Wind292 marked this pull request as draft March 15, 2026 04:58
@its-miroma its-miroma added the correction Something isn't right on a page label Mar 15, 2026
Copy link
Copy Markdown
Member

@its-miroma its-miroma left a comment

Choose a reason for hiding this comment

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

Thank you, this is a good idea! It was like this because there was a conflicting checkstyle rule, but that was changed recently and wasn't applied everywhere I guess. Maybe using a regex to look for \}\n\n\t*\/\/ will suffice?

Comment thread package-lock.json
@Wind292
Copy link
Copy Markdown
Contributor Author

Wind292 commented Mar 15, 2026

Maybe using a regex to look for \}\n\n\t*\/\/ will suffice?

I don't think just that check will work (it might help though; catching some cases). Sometimes people use the // #entrypoint with it ending at the end of the file, and because the linter wants a newline at the end of every file this would guarantee a newline, (there are other cases besides this one). Is there a way to check the vitepress's codeblocks to see if it has an extra newline displayed in the website?

Wind292 added 3 commits March 15, 2026 15:27
…t solution though. Assuming `timeSinceDropped` was not supposed to be shown
@Wind292
Copy link
Copy Markdown
Contributor Author

Wind292 commented Mar 15, 2026

I'm also noticing that a few of the codeblocks are displaying // ::: foo-bar. This is also very confusing and should be fixed.
image

@cputnam-a11y
Copy link
Copy Markdown

I'm also noticing that a few of the codeblocks are displaying // ::: foo-bar. This is also very confusing and should be fixed. image

This one is waiting on an upstream pr iirc

Wind292 added 2 commits March 15, 2026 16:40
…d a workaround since file refrencing didn't seem possible. Someone should improve this.
Copy link
Copy Markdown
Member

@its-miroma its-miroma left a comment

Choose a reason for hiding this comment

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

Do please revert the changes to package-lock.json. You should notice that running npm i again will do just that.

Comment thread develop/data-generation/advancements.md Outdated
Comment thread develop/data-generation/advancements.md Outdated
@its-miroma
Copy link
Copy Markdown
Member

Sorry, I was reviewing just as you pushed a commit reverting (:

@its-miroma its-miroma removed the request for review from a team March 15, 2026 22:10
Comment thread reference/latest/src/main/java/com/example/docs/block/ModBlocks.java Outdated
@Wind292
Copy link
Copy Markdown
Contributor Author

Wind292 commented Mar 15, 2026

Okay I think that's all. I'm going to undraft this now

@Wind292 Wind292 marked this pull request as ready for review March 15, 2026 22:57
@Wind292 Wind292 requested a review from its-miroma March 16, 2026 00:25
Comment thread reference/latest/src/main/java/com/example/docs/item/custom/CustomSoundItem.java Outdated
@its-miroma its-miroma merged commit f7a69b0 into FabricMC:main Mar 16, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

correction Something isn't right on a page

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants