From 53191a92be0c5edbf6e7b6d9681321531ba8cbaf Mon Sep 17 00:00:00 2001 From: nobody Date: Mon, 29 Mar 2021 17:52:21 -0700 Subject: [PATCH] minor markdown fixes --- doc/markdown.mc | 3 +-- include/bbcode.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/markdown.mc b/doc/markdown.mc index 6e0ae3389..75e2c41c3 100644 --- a/doc/markdown.mc +++ b/doc/markdown.mc @@ -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] diff --git a/include/bbcode.php b/include/bbcode.php index caf4d3f4c..699a45b87 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -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','
$3
',$Text); // markdown inline code blocks must be preceded by space or linebreak - $Text = preg_replace('# (?$1', $Text); + $Text = preg_replace('#(^|\n| )(?$2', $Text); // strip backslash escape for inline code $Text = preg_replace('#(\\\)`#','`',$Text); $Text = preg_replace('#<\/code><\/pre>\n
| .*?>)#','
',$Text);