Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 27ff28b

Browse files
author
Jamie Snape
committed
Improve markdown performance
1 parent ea66989 commit 27ff28b

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
"php": ">=5.3.23",
1414
"ext-gd": "*",
1515
"ext-json": "*",
16+
"erusev/parsedown-extra": "~0.7",
1617
"francodacosta/phmagick": "0.4.*@dev",
1718
"intervention/image": "~2.1",
1819
"ircmaxell/random-lib": "~1.1",
1920
"leafo/scssphp": "~0.1",
2021
"maennchen/zipstream-php": "~0.3",
21-
"michelf/php-markdown": "~1.4",
2222
"moontoast/math": "~1.1",
2323
"reprovinci/solr-php-client": "~1.0",
2424
"rhumsaa/uuid": "~2.8",

core/controllers/components/UtilityComponent.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,9 @@ public static function filterHtmlTags($text)
595595
*/
596596
public static function markdown($text)
597597
{
598-
return Michelf\MarkdownExtra::defaultTransform($text);
598+
$extra = new \ParsedownExtra();
599+
600+
return $extra->text($text);
599601
}
600602

601603
/**

core/views/community/view.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ $strippedDescription = strip_tags($description);
7272
<div id="communitySubtitle" class="genericSubtitle" style="color:grey;">
7373
<?php
7474
if (!empty($rawDescription)) {
75-
echo substr($this->escape($strippedDescription), 0, 240).'<a href="#" class="more">More &raquo;</a>';
75+
echo substr($this->escape($strippedDescription), 0, 240).' <a href="#" class="more">More &raquo;</a>';
7676
}
7777
?>
7878
</div>

modules/readmes/tests/controllers/ApiComponentControllerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function testFolderReadme()
6969

7070
$resp = $this->_callRestApi('GET', '/readmes/folder/'.$publicFolder->getKey());
7171
$this->_assertStatusOk($resp);
72-
$this->assertEquals($resp["body"]->data->text, "<p>This is a readme</p>\n");
72+
$this->assertEquals('<p>This is a readme</p>', $resp['body']->data->text);
7373
}
7474

7575
/** test readme on community */
@@ -107,6 +107,6 @@ public function testCommunityReadme()
107107

108108
$resp = $this->_callRestApi('GET', '/readmes/community/'.$comm->getKey());
109109
$this->_assertStatusOk($resp);
110-
$this->assertEquals($resp["body"]->data->text, "<p>This is a readme</p>\n");
110+
$this->assertEquals('<p>This is a readme</p>', $resp['body']->data->text);
111111
}
112112
}

0 commit comments

Comments
 (0)