minor markdown fixes

This commit is contained in:
nobody 2021-03-29 17:52:21 -07:00
parent 684f91f90a
commit 53191a92be
2 changed files with 2 additions and 3 deletions

View file

@ -39,10 +39,9 @@ Level headers must occur at the beginning of a line and be separated from the he
[/table]
[h3]Code and quotes[/h3]
The markdown specification allows code blocks to be any line beginning with 4 spaces or a tab. This particular syntax rule may produce undesirable results with normal text that wasn't intended to be part of a code block and is not supported in this application. Additionally, inline code must be preceded by at least one space character and may not occur at the beginning of a line.
The markdown specification allows code blocks to be any line beginning with 4 spaces or a tab. This particular syntax rule may produce undesirable results with normal text that wasn't intended to be part of a code block and is not supported in this application. Additionally, inline code must be preceded by at least one space character or occur at the beginning of a line. If you wish to insert backtick characters without triggering a code block, precede them with a backslash character or wrap the text in [nobb][nomd][/nomd][/nobb].
[table]
[tr][td]Markdown[/td][td]Result[/td][/tr]

View file

@ -1523,7 +1523,7 @@ function bbcode($Text, $options = []) {
// do not use the "indent by tab or 4 spaces" markdown codeblock trigger - this produces way too many false positives
// $Text = preg_replace('#^(?:\0(.*?)\0\n)?( {4}|\t)(.*?)$#m','<pre><code>$3</code></pre>',$Text);
// markdown inline code blocks must be preceded by space or linebreak
$Text = preg_replace('# (?<!\\\)`([^\n]+?)`#',' <code class="inline-code">$1</code>', $Text);
$Text = preg_replace('#(^|\n| )(?<!\\\)`([^\n`]+?)`#','$1<code class="inline-code">$2</code>', $Text);
// strip backslash escape for inline code
$Text = preg_replace('#(\\\)`#','`',$Text);
$Text = preg_replace('#<\/code><\/pre>\n<pre><code(>| .*?>)#','<br>',$Text);