Skip to content

content refacoring incorrectly strips certain classes away from img #2638

@dolfs

Description

@dolfs

Checklist

How did you create the site?

Generated from chirpy-starter

Describe the bug

When I use something like {% picture path.jpg class="right w-50" %} the refactoring code lifts the w-50 class to the enclosing , which is as intended. When I introduced some class definitions of my own, which were called w-50vw, they were lifted to the as well.

The code in the refactoring checks only for class names starting with "-w" and then lifts the whole thing. Originally meant for the bootstrap classes w-25, w-50, w-75 and w-100, perhaps they should more specifically check for those, but leave things like w-50vw alone so they will be applied to the img tag.

Furthermore, I defined some more classes, such as w-30, w-35 etc. to expand on the bootstrap set. In this case, of course, I would still want them "lifted" so perhaps the best check would be w-, or just simple document more clearly that any class prefixed with "w-" will be lifted. I could live with either one.

Steps To Reproduce

  1. Use "{% picture path.jpg class="right w-50" %}" and observe the w-50 class placed on the refactored around the img.
  2. Use "{% picture path.jpg class="right w_50" %}" and observe the w_50 class placed on the img
  3. Use "{% picture path.jpg class="right w-50vw" %}" and observe the w-50 class placed on the refactored around the img.

Expected Behavior

Expectation is to either:

  • Document any classes with prefix "w-" will get "lifted", and/or
  • Only lift classes of the form "w-" and document

This will allow anybody writing their own classes starting with w- not to be bewildered why they don't appear on the img tag.

Environment

Running bundle exec jekyll serve in a docker container

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions