githubtraining / intro-to-html

Course repo for Learning Lab course "Introduction to HTML". Template repo ➡️
https://github.com/githubtraining/intro-to-html-template
Creative Commons Attribution 4.0 International
7 stars 11 forks source link

CSS reference in incorrect spot not detected #32

Open amyschoen opened 4 years ago

amyschoen commented 4 years ago

Bug Report

Current behavior I purposely added the CSS in the wrong part of the HTML file, and the step completed successfully.

    <head>
        <title>My awesome web page</title>
    </head>

    <link rel="stylesheet" href="style.css">

Reproduction Steps to reproduce the behavior in the course:

  1. Go to Step 12.
  2. Edit the HTML file to add the link to the CSS file but don't put it in the head block.
  3. The bot replies back with successful completion of this step.

Expected behavior I would expect that the bot would detect that this is not in the correct spot and give feedback on how to fix it.

Possible solution If you have suggestions, we'd love to hear them. If not, that's ok too.

Additional context Learning Lab v0.5.0

/cc @crichID @brianamarie @hectorsector @JasonEtco

brianamarie commented 4 years ago

Thank you for opening this issue, @amyschoen. This is a tricky one to fix. As you probably know, the way that Learning Lab is checking for the CSS is with regex.

So far, we've been walking a fine line, trying to balance:

After playing around with a bit of regex, this may be one improvement option: (<link rel="stylesheet" href="style.css">)(.+)?(\n+)?(.+)?(\n+)?(.+)?(<\/head>) (in this part of the config).

amyschoen commented 4 years ago

I didn't know that regex was being used, but that makes a lot of sense. What flavor of regex are you using? Is it JS since things are written in node? That should suffice, but could likely be simplified a bit.

brianamarie commented 4 years ago

I didn't know that regex was being used, but that makes a lot of sense. What flavor of regex are you using? Is it JS since things are written in node? That should suffice, but could likely be simplified a bit.

I believe it is JS, but would recommend testing to be sure.