Skip to content

Commit

Permalink
fix(m2h): don't delete p's in li's (#11930)
Browse files Browse the repository at this point in the history
* fix(m2h): don't delete p's in li's but hide them

In order to have more predictable html we keep the p's
(expect for empty ones) and "hide" them via display: contents.

* fix curriculum

* use margin 0
  • Loading branch information
fiji-flo authored Oct 9, 2024
1 parent 72c4f53 commit 41e892e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions client/src/curriculum/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@
color: var(--text-visited);
}
}

ol,
ul {
li > p {
margin: 0;
}
}
}

&.with-sidebar {
Expand Down
4 changes: 4 additions & 0 deletions client/src/document/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@

li {
margin: 0.5rem 0;

> p {
margin: 0;
}
}
}

Expand Down
6 changes: 4 additions & 2 deletions markdown/m2h/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,10 @@ export function buildLocalizedHandlers(locale: Locale): Handlers {
children:
"children" in item
? item.children.flatMap((child) =>
"tagName" in child && child.tagName == "p"
? child.children
"tagName" in child &&
child.tagName == "p" &&
child.children?.length === 0
? []
: [child]
)
: [],
Expand Down

0 comments on commit 41e892e

Please sign in to comment.