markdown and help stuff

This commit is contained in:
nobody 2021-03-04 19:52:58 -08:00
parent fdbb8eb417
commit 52314eda78
4 changed files with 10 additions and 9 deletions

View file

@ -16,7 +16,7 @@ use Zotlabs\Daemon\Run;
* @brief This file defines some global constants and includes the central App class.
*/
define ( 'STD_VERSION', '21.03.02' );
define ( 'STD_VERSION', '21.03.05' );
define ( 'ZOT_REVISION', '6.0' );
define ( 'DB_UPDATE_VERSION', 1247 );

View file

@ -23,7 +23,6 @@ To avoid surprises, please use preview when attempting something complex. To pre
Markdown is very susceptible to "false positives" which may add markup instructions unintentionally when using punctuation characters in unusual or uncommon ways. This can happen (for instance) if you include computer code in a post without identifying it as a block of code. If a markdown sequence is not rendered correctly, try adding space around the triggering punctuation and ensure that all computer code is placed in code blocks.
Markdown has two methods for creating code blocks. One of them is to wrap the code block with 3 backticks (```) alone on a line before and after the code. The second is to indent the text 4 spaces or one tab width. This second form causes a lot of false positives in otherwise normal text and for that reason is not supported here.
HTML must be heavily filtered on multi-user web applications to avoid/prevent a type of bad behaviour called "Cross-site scripting". You may not use Javascript at all, and there are a number of restrictions placed on rich-media elements such as audio/video tags and cross-domain content such as iframes. We use bbcode internally for many of these constructs - which will become apparent if you include a video or other rich media link. You may wish to do the same.
Also be aware that all line breaks in your posts are preserved and this may affect the display of HTML lists and tables. When using HTML to create such elements, you may be tempted to make them look "neat" by placing each table or list element on its own line. Don't do this, due to the preserved line breaks. Each list or table row should butt up against the one before it without including a blank line in between them.
Also be aware that all line breaks in your posts are normally preserved and this may affect the display of HTML lists and tables. When using HTML to create such elements, you may be tempted to make them look "neat" by placing each table or list element on its own line. This will not usually display correctly and could include a number of extraneous blank lines, due to the preserved line breaks. For best results when creating lists and tables in HTML, each HTML list element or table row should butt up against the one before it without including any line breaks in between them.

View file

@ -1480,13 +1480,15 @@ function bbcode($Text, $options = []) {
$Text = preg_replace('#(?<!\\\)([*_]{3})([^\n]+?)\1#','<strong><em>$2</em></strong>',$Text);
$Text = preg_replace('#(?<!\\\)([*_]{2})([^\n]+?)\1#','<strong>$2</strong>',$Text);
// The character check is so we don't mistake underscore in the middle of a code variable as an italic trigger.
$Text = preg_replace_callback('#(^| )(?<!\\\)([*_])([^\n|`]+?)\2#m','md_italic',$Text);
// The character check is so we don't mistake underscore in the middle of conversational text as an italic trigger.
$Text = preg_replace_callback('#(^|\n| )(?<!\\\)([*_])([^\n|`]+?)\2#m','md_italic',$Text);
$Text = preg_replace_callback('{ ^(.+?)[ ]*\n(=+|-+)[ ]*\n+ }mx','md_topheader', $Text);
$Text = preg_replace_callback('#^(\#{1,6})\s+([^\#]+?)\s*\#*$#m','md_header', $Text);
$Text = preg_replace_callback('#(^|\n)([`~]{3,})(?: *\.?([a-zA-Z0-9\-.]+))?\n+([\s\S]+?)\n+\2(\n|$)#','md_codeblock',$Text);
// $Text = preg_replace('#^(?:\0(.*?)\0\n)?( {4}|\t)(.*?)$#m','<pre><code>$3</code></pre>',$Text);
$Text = preg_replace('#(?<!\\\)`([^\n]+?)`#','<pre><code>$1</code></pre>', $Text);
// 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| )(?<!\\\)`([^\n]+?)`#','$1<code class="inline-code">$2</code>', $Text);
$Text = preg_replace('#<\/code><\/pre>\n<pre><code(>| .*?>)#','<br>',$Text);
// blockquotes

View file

@ -171,7 +171,7 @@ function nav($template = 'default') {
$search_form_action = 'search';
$nav['search'] = ['search', t('Search'), "", t('Search site @name, #tag, content'), $search_form_action];
$nav['search'] = ['search', t('Search'), "", t('Search site @name, #tag, ?doc, content'), $search_form_action];
/**
* Admin page
@ -296,7 +296,7 @@ function nav($template = 'default') {
'$is_owner' => $is_owner,
'$sel' => App::$nav_sel,
'$powered_by' => $powered_by,
'$help' => t('@name, #tag, content'),
'$help' => t('@name, #tag, ?doc, content'),
'$pleasewait' => t('Please wait...'),
'$nav_apps' => $nav_apps,
'$navbar_apps' => $navbar_apps,