-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Components: Normalize newlines in auto-generated READMEs #68208
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Flaky tests detected in e5e4a65. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12436516579
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Just a minor question to confirm my assumptions.
@@ -8,14 +8,18 @@ import json2md from 'json2md'; | |||
*/ | |||
import { generateMarkdownPropsJson } from './props.mjs'; | |||
|
|||
function normalizeTrailingNewline( str ) { | |||
return str?.length ? str.replace( /\n*$/, '\n' ) : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be sure I understand, this aims to result in having exactly one newline, even if the description doesn't come with a newline, right? Even in the case of an empty description string, which will also result in just a newline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I hope this captures the intent better: e5e4a65
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it does 👍 Also thanks for using trim()
instead of length
, that basically makes it impossible to break with an arbitrary space or tab.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to ship 🚀
What?
Fixes a minor issue with component descriptions running into the next sections due to a missing newline.
Why?
This missing newline isn't visible when the Markdown is rendered to HTML, but is a bit messy when reading as raw Markdown text.
Testing Instructions
npm run docs:components
to regenerate the README files.