independant elements from p + delete p from li

This commit is contained in:
Julie Blanc 2026-03-08 20:40:25 +01:00
parent 048a1b67e6
commit c321a17f3e
8 changed files with 36 additions and 19 deletions

View file

@ -107,10 +107,10 @@ h2{
h5{
display: flex;
align-items: center;
}
}*/
.marker-title img{
width: 40px;
} */
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

Before After
Before After

View file

View file

@ -22,6 +22,13 @@ function resolveFileUrl($field, $page) {
return null;
}
/**
* Supprime les <p> imbriqués dans les <li> (générés par Kirby pour les listes "loose")
*/
function stripParagraphsInListItems($html) {
return preg_replace('/<li>\s*<p>(.*?)<\/p>\s*<\/li>/s', '<li>$1</li>', $html);
}
/**
* Résout les images dans le contenu HTML
*/
@ -63,7 +70,7 @@ function parseBlocks($blocksField, $page) {
switch ($block->type()) {
case 'text':
$blockData['content'] = [
'text' => resolveImagesInHtml($block->text()->value(), $page)
'text' => stripParagraphsInListItems(resolveImagesInHtml($block->text()->value(), $page))
];
break;
@ -87,7 +94,7 @@ function parseBlocks($blocksField, $page) {
case 'list':
$blockData['content'] = [
'text' => $block->text()->value()
'text' => stripParagraphsInListItems($block->text()->value())
];
break;