Update code tag styling so bbcode [code] blocks and wiki markdown inline code render nicely.
This commit is contained in:
		| @@ -628,7 +628,7 @@ function bb_code_unprotect_sub($match) { | |||||||
|  |  | ||||||
| function bb_code($match) { | function bb_code($match) { | ||||||
| 	if(strpos($match[0], "<br />")) | 	if(strpos($match[0], "<br />")) | ||||||
| 		return '<code>' . bb_code_protect(trim($match[1])) . '</code>'; | 		return '<pre><code>' . bb_code_protect(trim($match[1])) . '</code></pre>'; | ||||||
| 	else | 	else | ||||||
| 		return '<code class="inline-code">' . bb_code_protect(trim($match[1])) . '</code>'; | 		return '<code class="inline-code">' . bb_code_protect(trim($match[1])) . '</code>'; | ||||||
| } | } | ||||||
| @@ -636,15 +636,21 @@ function bb_code($match) { | |||||||
| function bb_code_options($match) { | function bb_code_options($match) { | ||||||
| 	if(strpos($match[0], "<br />")) { | 	if(strpos($match[0], "<br />")) { | ||||||
| 		$class = ""; | 		$class = ""; | ||||||
|  | 		$pre = true; | ||||||
| 	} else { | 	} else { | ||||||
| 		$class = "inline-code"; | 		$class = "inline-code"; | ||||||
|  | 		$pre = false; | ||||||
| 	} | 	} | ||||||
| 	if(strpos($match[1], 'nowrap')) { | 	if(strpos($match[1], 'nowrap')) { | ||||||
| 		$style = "overflow-x: auto; white-space: pre;"; | 		$style = "overflow-x: auto; white-space: pre;"; | ||||||
| 	} else { | 	} else { | ||||||
| 		$style = ""; | 		$style = ""; | ||||||
| 	} | 	} | ||||||
| 	return '<code class="'. $class .'" style="'. $style .'">' . bb_code_protect(trim($match[2])) . '</code>'; | 	if($pre) { | ||||||
|  | 		return '<pre><code class="'. $class .'" style="'. $style .'">' . bb_code_protect(trim($match[2])) . '</code></pre>'; | ||||||
|  | 	} else {	 | ||||||
|  | 		return '<code class="'. $class .'" style="'. $style .'">' . bb_code_protect(trim($match[2])) . '</code>'; | ||||||
|  | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| function bb_highlight($match) { | function bb_highlight($match) { | ||||||
|   | |||||||
| @@ -48,3 +48,24 @@ td i { | |||||||
| 	padding-right: 10px; | 	padding-right: 10px; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | pre code { | ||||||
|  | 	background: #F5F5F5; | ||||||
|  | 	font-family: Courier, monospace; | ||||||
|  | 	font-size: 1em; | ||||||
|  | 	padding: 1em 1.5em; | ||||||
|  | 	display: block; | ||||||
|  | 	white-space: pre-wrap; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | code { | ||||||
|  | 	background: #F5F5F5; | ||||||
|  | 	font-family: Courier, monospace; | ||||||
|  | 	font-size: 1em; | ||||||
|  | 	display: inline; | ||||||
|  | 	padding: 0.2em 0.2em; | ||||||
|  | 	white-space: pre-wrap; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #wiki-content-container code { | ||||||
|  | 	background: #F5F5F5; | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user