Fix numbered list indentation to match bullet lists with dedicated class and targeted CSS

This commit is contained in:
Marcus Quinn
2025-03-24 22:33:07 +00:00
parent e00c627410
commit 09aebfcc98
2 changed files with 11 additions and 11 deletions

View File

@ -1025,18 +1025,18 @@ body.wp-admin .button.pricing-button:hover,
#readme .wp-allstars-markdown-content ol.wp-allstars-list, #readme .wp-allstars-markdown-content ol.wp-allstars-list,
#readme .wp-allstars-markdown-content ol { #readme .wp-allstars-markdown-content ol {
padding-left: 25px; /* Same padding as bullet lists for consistent indentation */ padding-left: 25px; /* Same as bullets */
margin: 10px 0; margin: 10px 0;
list-style-type: decimal; list-style-type: decimal;
} }
/* Adjust for the wider numbers to align text with bullet lists */ /* Special styling for numbered lists to align with bullet lists */
#readme .wp-allstars-markdown-content ol.wp-allstars-list li, #readme .wp-allstars-markdown-content ol.numbered-list {
#readme .wp-allstars-markdown-content ol li { padding-left: 19px; /* Adjusted to better align with bullets */
padding-left: 0; /* Remove extra padding */ }
margin-left: -5px; /* Subtle adjustment to align text with bullet lists */
text-indent: -5px; /* Adjust text indent to align with bullet text */ #readme .wp-allstars-markdown-content ol.numbered-list li {
padding-right: 10px; /* Prevent text from being too close to the edge */ margin-left: 4px; /* Fine-tune the alignment */
} }
#readme .wp-allstars-markdown-content li { #readme .wp-allstars-markdown-content li {

View File

@ -97,14 +97,14 @@ class WP_Allstars_Readme_Manager {
// First group bullet items into unordered lists // First group bullet items into unordered lists
$markdown = preg_replace('/((?:<li class="bullet-item">.*?<\/li>\n)+)/s', '<ul class="wp-allstars-ul">$1</ul>', $markdown); $markdown = preg_replace('/((?:<li class="bullet-item">.*?<\/li>\n)+)/s', '<ul class="wp-allstars-ul">$1</ul>', $markdown);
// Then group numbered items into ordered lists // Then group numbered items into ordered lists with a special class for indentation
$markdown = preg_replace('/((?:<li class="number-item">.*?<\/li>\n)+)/s', '<ol class="wp-allstars-ol">$1</ol>', $markdown); $markdown = preg_replace('/((?:<li class="number-item">.*?<\/li>\n)+)/s', '<ol class="wp-allstars-ol numbered-list">$1</ol>', $markdown);
// Clean up the classes from the final output // Clean up the classes from the final output
$markdown = str_replace('class="bullet-item"', '', $markdown); $markdown = str_replace('class="bullet-item"', '', $markdown);
$markdown = str_replace('class="number-item"', '', $markdown); $markdown = str_replace('class="number-item"', '', $markdown);
$markdown = str_replace('class="wp-allstars-ul"', 'class="wp-allstars-list"', $markdown); $markdown = str_replace('class="wp-allstars-ul"', 'class="wp-allstars-list"', $markdown);
$markdown = str_replace('class="wp-allstars-ol"', 'class="wp-allstars-list"', $markdown); $markdown = str_replace('class="wp-allstars-ol numbered-list"', 'class="wp-allstars-list numbered-list"', $markdown);
// Links // Links
$markdown = preg_replace('/\[(.*?)\]\((.*?)\)/s', '<a href="$2" target="_blank">$1</a>', $markdown); $markdown = preg_replace('/\[(.*?)\]\((.*?)\)/s', '<a href="$2" target="_blank">$1</a>', $markdown);