Add support for numbered lists in Read Me tab with consistent styling
This commit is contained in:
@ -1015,13 +1015,19 @@ body.wp-admin .button.pricing-button:hover,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Readme bullet list styling */
|
/* Readme list styling */
|
||||||
#readme .wp-allstars-markdown-content ul {
|
#readme .wp-allstars-markdown-content ul {
|
||||||
list-style-type: disc;
|
list-style-type: disc;
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
margin: 10px 0;
|
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 {
|
#readme .wp-allstars-markdown-content li {
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
|
@ -93,6 +93,11 @@ class WP_Allstars_Readme_Manager {
|
|||||||
$markdown = preg_replace('/^\* (.*?)$/m', '<li>$1</li>', $markdown);
|
$markdown = preg_replace('/^\* (.*?)$/m', '<li>$1</li>', $markdown);
|
||||||
$markdown = preg_replace('/(<li>.*?<\/li>\n)+/s', '<ul>$0</ul>', $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
|
// 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);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user