-
Notifications
You must be signed in to change notification settings - Fork 3
HTML Hint showcase #19
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
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughA new Changes
Poem
✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.htmlhintrc (1)
8-9
: Trim trailing blank lines.The extra blank lines at the end of the JSON file are harmless but unnecessary. Removing them keeps the config tidy and avoids spurious diffs later.
"id-unique": true } - -
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.htmlhintrc
(1 hunks)test.html
(1 hunks)
🧰 Additional context used
🪛 HTMLHint (1.5.0)
test.html
[error] 1-1: Doctype must be declared before any non-comment content.
(doctype-first)
[error] 3-3: Tag must be paired, missing: [ </title></title> ], start tag match failed [ <title> ] on line 3.
(tag-pair)
[error] 12-12: Tag must be paired, missing: [
], start tag match failed [(tag-pair)
[error] 16-16: Tag must be paired, missing: [ ], start tag match failed [
] on line 16.
(tag-pair)
🔇 Additional comments (1)
.htmlhintrc (1)
1-6
: Sound rule selection – good starter set.The chosen rules cover the most common authoring mistakes and will surface useful feedback without being overly restrictive. Nice foundation.
</ul | ||
</body> | ||
</html> | ||
<html><body><h1>Oops<img src="a.png"></body></html> |
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.
🛠️ Refactor suggestion
Two complete HTML documents in one file – split or comment out.
Line 16 embeds a second <html>
element directly after the first document’s closing tag. Browsers treat everything after the first root element unpredictably, and HTMLHint will report duplicate-ID issues if any appear. If you need both snippets, place each in its own file (e.g., test-bad.html
and test-good.html
) or wrap the second inside a comment.
🧰 Tools
🪛 HTMLHint (1.5.0)
[error] 16-16: Tag must be paired, missing: [ </h1> ], start tag match failed [ <h1> ] on line 16.
(tag-pair)
🤖 Prompt for AI Agents
In test.html at line 16, there is a second <html> element embedded directly
after the first document's closing tag, causing invalid HTML structure. To fix
this, either split the content into two separate HTML files or comment out the
second <html> element and its contents to avoid duplicate root elements and
potential duplicate-ID issues.
<html> | ||
<head> | ||
<title>Bad Page<title> | ||
</head> | ||
<body> | ||
<h1>Welcome | ||
<img src="image.jpg"> | ||
<p>This paragraph is missing its closing tag | ||
<a href="about.html">About us | ||
<ul> | ||
<li>Item 1 | ||
<li>Item 2 | ||
</ul | ||
</body> | ||
</html> |
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.
Document lacks DOCTYPE and several closing tags – HTMLHint will flag this.
Right now the first fragment violates every rule you just enabled:
- No
<!DOCTYPE html>
before<html>
→doctype-first
. - Unclosed
<title>
,<h1>
,<p>
,<a>
,<li>
tags →tag-pair
. - Malformed
</ul
(missing>
) → parsing error.
Unless the goal is to demonstrate failing cases, consider fixing them so the file passes lint:
+<!DOCTYPE html>
<html>
<head>
- <title>Bad Page<title>
+ <title>Bad Page</title>
</head>
<body>
- <h1>Welcome
- <img src="image.jpg">
- <p>This paragraph is missing its closing tag
- <a href="about.html">About us
- <ul>
- <li>Item 1
- <li>Item 2
- </ul
+ <h1>Welcome</h1>
+ <img src="image.jpg" alt="Sample image">
+ <p>This paragraph is now properly closed.</p>
+ <a href="about.html">About us</a>
+ <ul>
+ <li>Item 1</li>
+ <li>Item 2</li>
+ </ul>
</body>
</html>
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<html> | |
<head> | |
<title>Bad Page<title> | |
</head> | |
<body> | |
<h1>Welcome | |
<img src="image.jpg"> | |
<p>This paragraph is missing its closing tag | |
<a href="about.html">About us | |
<ul> | |
<li>Item 1 | |
<li>Item 2 | |
</ul | |
</body> | |
</html> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Bad Page</title> | |
</head> | |
<body> | |
<h1>Welcome</h1> | |
<img src="image.jpg" alt="Sample image"> | |
<p>This paragraph is now properly closed.</p> | |
<a href="about.html">About us</a> | |
<ul> | |
<li>Item 1</li> | |
<li>Item 2</li> | |
</ul> | |
</body> | |
</html> |
🧰 Tools
🪛 HTMLHint (1.5.0)
[error] 1-1: Doctype must be declared before any non-comment content.
(doctype-first)
[error] 3-3: Tag must be paired, missing: [ </title></title> ], start tag match failed [ <title> ] on line 3.
(tag-pair)
[error] 12-12: Tag must be paired, missing: [
], start tag match failed [(tag-pair)
🤖 Prompt for AI Agents
In test.html lines 1 to 15, the document is missing the <!DOCTYPE html>
declaration at the top, and several tags such as <title>, <h1>, <p>, <a>, and
<li> are not properly closed. Additionally, the closing </ul> tag is malformed
and missing the closing angle bracket. To fix this, add <!DOCTYPE html> before
the <html> tag, properly close all opened tags with their corresponding closing
tags, and correct the </ul> tag by adding the missing '>'. This will ensure the
HTML is well-formed and passes lint checks.
Summary by CodeRabbit