Skip to content
9 changes: 5 additions & 4 deletions web_src/css/markup/content.css
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@

.markup ul,
.markup ol {
padding-left: 2em;
padding-left: 0;
Copy link
Contributor

@kdumontnu kdumontnu Sep 7, 2023

Choose a reason for hiding this comment

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

@rafh I'm worried about this style affecting other elements unrelated to checkboxes. Are there other markdown ul ol items this will apply to in markdown (I assume yes)?

Especially because this value was not changed here: https://github.com/go-gitea/gitea/pull/17411/files

(btw, this is an area front-end testing could validate)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kdumontnu I understand your point. Instead, we should change the em back to 2em and update the .task-list-item to have margin-left: -2em;. This will ensure that all checkboxes are aligned properly without impacting all ol and ul.

Here's an example of the markup and how it is rendered within Gitea.

- [x] example content

<img  align="left" alt="" width="200" src="https://user-images.githubusercontent.com/6152817/265531274-d0b0b99a-db2b-4b6d-946d-277bfd24fc11.jpg">

- [x] example content

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur sed efficitur orci, eu cursus sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur sed efficitur orci, eu cursus sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur sed efficitur orci, eu cursus sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur sed efficitur orci, eu cursus sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur sed efficitur orci, eu cursus sapien.

<img style="clear: both" alt="" width="200" src="https://user-images.githubusercontent.com/6152817/265531274-d0b0b99a-db2b-4b6d-946d-277bfd24fc11.jpg">


- [ ] one

- [ ] two
Screenshot 2023-09-07 at 2 51 27 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

That seems like a reasonable solution to me, or maybe you can add a :not(.task-list-item) to the selectors above and. Whatever will apply the style to the .task-list-item items, but not change the styling for other lists.

}

.markup ul.no-list,
Expand All @@ -158,12 +158,13 @@
position: relative;
line-height: 1.5rem;
min-height: 1.5rem; /* // to render a checkbox list without content `- [ ]`, we need this min-height to make sure the <li> can be visible */
display: flex;
align-items: center;
}

.markup .task-list-item input[type="checkbox"] {
position: absolute;
top: 0.25em;
left: -1.6em;
flex: 0 0 auto;
margin-right: .6em;
}

.markup .task-list-item p {
Expand Down