]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Text/Markdown.php
Fix IHTTPResult::getHeader()
[friendica.git] / src / Content / Text / Markdown.php
index 45f38e4c5b3896c125587619c5926a7d69e50c2f..905860647f0f83a9bb17c13f2e3d2b6a1338c29e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -21,7 +21,6 @@
 
 namespace Friendica\Content\Text;
 
-use Friendica\Core\System;
 use Friendica\DI;
 use Friendica\Model\Contact;
 
@@ -40,7 +39,7 @@ class Markdown
         * @return string
         */
        public static function convert($text, $hardwrap = true, $baseuri = null) {
-               $stamp1 = microtime(true);
+               DI::profiler()->startRecording('rendering');
 
                $MarkdownParser = new MarkdownParser();
                $MarkdownParser->code_class_prefix  = 'language-';
@@ -57,7 +56,7 @@ class Markdown
 
                $html = $MarkdownParser->transform($text);
 
-               DI::profiler()->saveTimestamp($stamp1, "parser");
+               DI::profiler()->stopRecording();
 
                return $html;
        }
@@ -109,6 +108,8 @@ class Markdown
         */
        public static function toBBCode($s)
        {
+               DI::profiler()->startRecording('rendering');
+
                // The parser cannot handle paragraphs correctly
                $s = str_replace(['</p>', '<p>', '<p dir="ltr">'], ['<br>', '<br>', '<br>'], $s);
 
@@ -134,6 +135,7 @@ class Markdown
                // Don't show link to full picture (until it is fixed)
                $s = BBCode::scaleExternalImages($s);
 
+               DI::profiler()->stopRecording();
                return $s;
        }
 }