Add support for numbered lists in Read Me tab with consistent styling

This commit is contained in:
Marcus Quinn
2025-03-24 22:17:38 +00:00
parent 5a28089043
commit 19cd4d3355
2 changed files with 12 additions and 1 deletions

View File

@ -1015,13 +1015,19 @@ body.wp-admin .button.pricing-button:hover,
}
}
/* Readme bullet list styling */
/* Readme list styling */
#readme .wp-allstars-markdown-content ul {
list-style-type: disc;
padding-left: 20px;
margin: 10px 0;
}
#readme .wp-allstars-markdown-content ol {
list-style-type: decimal;
padding-left: 20px;
margin: 10px 0;
}
#readme .wp-allstars-markdown-content li {
margin-bottom: 6px;
line-height: 1.4;

View File

@ -93,6 +93,11 @@ class WP_Allstars_Readme_Manager {
$markdown = preg_replace('/^\* (.*?)$/m', '<li>$1</li>', $markdown);
$markdown = preg_replace('/(<li>.*?<\/li>\n)+/s', '<ul>$0</ul>', $markdown);
// Numbered Lists
$markdown = preg_replace('/^\d+\. (.*?)$/m', '<li>$1</li>', $markdown);
// Convert consecutive numbered list items to an ordered list
$markdown = preg_replace('/((?:<li>.*?<\/li>\n)+)(?!<\/ul>|<\/ol>)/s', '<ol>$1</ol>', $markdown);
// Links
$markdown = preg_replace('/\[(.*?)\]\((.*?)\)/s', '<a href="$2" target="_blank">$1</a>', $markdown);