Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php	(revision 5037)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php	(working copy)
@@ -389,7 +389,29 @@
 add_filter( 'bbp_get_topic_edit_url', 'wporg_support_fix_pending_posts_reply_url', 10, 2 );
 add_filter( 'bbp_get_reply_edit_url', 'wporg_support_fix_pending_posts_reply_url', 10, 2 );
 
+/**
+ * Prevent standalone <li> tags from breaking the theme layout.
+ *
+ * If a <li> tag is not preceded by <ul> or <ol>, prepend it with <ul>
+ * and let force_balance_tags() do the rest.
+ *
+ * @see https://meta.trac.wordpress.org/ticket/20
+ *
+ * @param string $content Topic or reply content.
+ * @return string Filtered content.
+ */
+function wporg_support_wrap_standalone_li_tags_in_ul( $content ) {
+	if ( false !== strpos( $content, '<li>' ) ) {
+		$content = preg_replace( '#(?<!<ul>\s|<ol>\s)<li>#', '<ul><li>', $content );
+		$content = force_balance_tags( $content );
+	}
 
+	return $content;
+}
+add_filter( 'bbp_get_topic_content', 'wporg_support_wrap_standalone_li_tags_in_ul', 50 );
+add_filter( 'bbp_get_reply_content', 'wporg_support_wrap_standalone_li_tags_in_ul', 50 );
+
+
 /** bb Base *******************************************************************/
 
 function bb_base_search_form() {
