-
Notifications
You must be signed in to change notification settings - Fork 779
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
fix(p-as-heading): p-as-heading
rule to account for textContent
length
#3145
Conversation
@WilcoFiers we had questions on this requirement:
There's a gap in the algorithm, like what happens if it's more than twice as long but not greater than the length. Could you give a bit more clarification? Here's what I have reading that description: const headingLength = headingEl.textContent.length;
const paragraphLength = pEl.textContext.length;
if (headingLength > paragraphLength) {
return true;
}
else if (headingLength < paragraphLength / 2) {
return false;
}
else {
return undefined;
} |
@straker I think your dummy code is pretty much how I think of it. We should probably put in options to make these values configurable. Beyond that, these seem like reasonable heuristics for this rule. |
@WilcoFiers Could you provide a bit more info on configurable by options? |
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.
One comment, rest looks good.
p-as-heading
rule to account for textContent
lengthp-as-heading
rule to account for textContent
length
Co-authored-by: Wilco Fiers <[email protected]>
Co-authored-by: Wilco Fiers <[email protected]>
Ref: #3130