Skip to content

Commit

Permalink
fix(m2h): don't delete p's in li's but hide them
Browse files Browse the repository at this point in the history
In order to have more predictable html we keep the p's
(expect for empty ones) and "hide" them via display: contents.
  • Loading branch information
fiji-flo committed Oct 8, 2024
1 parent 798536b commit 3db23b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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 {
display: contents;
}
}
}

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 3db23b6

Please sign in to comment.