Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

HTML Hint showcase #19

wants to merge 1 commit into from

Conversation

nimratcoderabbit
Copy link

@nimratcoderabbit nimratcoderabbit commented Jul 14, 2025

image

Summary by CodeRabbit

  • Chores
    • Added a configuration file to enforce HTML code quality standards.
    • Introduced a sample HTML file containing both valid and invalid HTML markup for testing and validation purposes.

Copy link

coderabbitai bot commented Jul 14, 2025

📝 Walkthrough

Walkthrough

A new .htmlhintrc configuration file is added to set up HTML linting rules, and a test.html file is introduced containing two HTML fragments—one with intentional HTML syntax errors and another with correct syntax. No changes are made to any exported or public code entities.

Changes

File(s) Change Summary
.htmlhintrc Added configuration file enabling four HTMLHint rules for basic HTML validation.
test.html Added an HTML file with two fragments: one with multiple HTML errors, one with correct syntax.

Poem

In the land of tags and quotes so bright,
A linter’s rules now guide our sight.
One test file, errors bold and clear,
Another shines, with syntax dear.
Let’s lint and learn, with code in view—
HTML’s best, and worst, on cue!
✨📝

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch preview/html

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@nimratcoderabbit
Copy link
Author

@coderabbitai full review

Copy link

coderabbitai bot commented Jul 14, 2025

✅ Actions performed

Full review triggered.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between ef04b8d and 77a5e05.

📒 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 [
  • ] on line 12.

    (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>
    Copy link

    @coderabbitai coderabbitai bot Jul 14, 2025

    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.
    

    Comment on lines +1 to +15
    <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>
    Copy link

    Choose a reason for hiding this comment

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

    ⚠️ Potential issue

    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.

    Suggested change
    <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 [
  • ] on line 12.

    (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.
    

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

    Successfully merging this pull request may close these issues.

    1 participant