parsedown -> commonmark
This commit is contained in:
parent
d75a7d3ead
commit
8f731e9031
@ -6,7 +6,7 @@ use App\Models\User;
|
||||
use App\Notifications;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Parsedown;
|
||||
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||
|
||||
class NotificationsController extends Controller
|
||||
{
|
||||
@ -63,11 +63,11 @@ class NotificationsController extends Controller
|
||||
});
|
||||
$notification->markAsRead();
|
||||
|
||||
$parsedown = new Parsedown();
|
||||
$converter = new GithubFlavoredMarkdownConverter();
|
||||
|
||||
return [
|
||||
'title' => $notification->data['title'],
|
||||
'content' => $parsedown->text($notification->data['content']),
|
||||
'content' => $converter->convertToHtml($notification->data['content']),
|
||||
'time' => $notification->created_at->toDateTimeString(),
|
||||
];
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ use App\Services\Unzip;
|
||||
use Composer\CaBundle\CaBundle;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Parsedown;
|
||||
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||
|
||||
class PluginController extends Controller
|
||||
{
|
||||
@ -42,8 +42,8 @@ class PluginController extends Controller
|
||||
|
||||
$title = trans($plugin->title);
|
||||
$path = $plugin->getPath().'/'.$readmePath;
|
||||
$parsedown = new Parsedown();
|
||||
$content = $parsedown->text(file_get_contents($path));
|
||||
$converter = new GithubFlavoredMarkdownConverter();
|
||||
$content = $converter->convertToHtml(file_get_contents($path));
|
||||
|
||||
return view('admin.plugin.readme', compact('content', 'title'));
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Parsedown;
|
||||
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||
use Storage;
|
||||
|
||||
class SkinlibController extends Controller
|
||||
@ -169,7 +169,7 @@ class SkinlibController extends Controller
|
||||
];
|
||||
$grid = $filter->apply('grid:skinlib.upload', $grid);
|
||||
|
||||
$parsedown = new Parsedown();
|
||||
$converter = new GithubFlavoredMarkdownConverter();
|
||||
|
||||
return view('skinlib.upload')
|
||||
->with('grid', $grid)
|
||||
@ -186,7 +186,7 @@ class SkinlibController extends Controller
|
||||
'scorePrivate' => (int) option('private_score_per_storage'),
|
||||
'closetItemCost' => (int) option('score_per_closet_item'),
|
||||
'award' => (int) option('score_award_per_texture'),
|
||||
'contentPolicy' => $parsedown->text(option_localized('content_policy')),
|
||||
'contentPolicy' => $converter->convertToHtml(option_localized('content_policy')),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,8 @@ use Blessing\Rejection;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Http\Request;
|
||||
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||
use Mail;
|
||||
use Parsedown;
|
||||
use Session;
|
||||
use URL;
|
||||
|
||||
@ -58,7 +58,7 @@ class UserController extends Controller
|
||||
];
|
||||
$grid = $filter->apply('grid:user.index', $grid);
|
||||
|
||||
$parsedown = new Parsedown();
|
||||
$converter = new GithubFlavoredMarkdownConverter();
|
||||
|
||||
return view('user.index')->with([
|
||||
'score_intro' => $scoreIntro,
|
||||
@ -67,7 +67,7 @@ class UserController extends Controller
|
||||
'player' => option('score_per_player'),
|
||||
'closet' => option('score_per_closet_item'),
|
||||
],
|
||||
'announcement' => $parsedown->text(option_localized('announcement')),
|
||||
'announcement' => $converter->convertToHtml(option_localized('announcement')),
|
||||
'grid' => $grid,
|
||||
'extra' => ['unverified' => option('require_verification') && !$user->verified],
|
||||
]);
|
||||
|
@ -5,7 +5,7 @@ namespace Tests;
|
||||
use App\Models\User;
|
||||
use App\Notifications;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Parsedown;
|
||||
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||
|
||||
class NotificationsControllerTest extends TestCase
|
||||
{
|
||||
@ -114,10 +114,11 @@ class NotificationsControllerTest extends TestCase
|
||||
|
||||
$this->actingAs($user)->get('/user')->assertSee('Hyouka');
|
||||
|
||||
$converter = new GithubFlavoredMarkdownConverter();
|
||||
$this->postJson('/user/notifications/'.$notification->id)
|
||||
->assertJson([
|
||||
'title' => $notification->data['title'],
|
||||
'content' => (new Parsedown())->text($notification->data['content']),
|
||||
'content' => $converter->convertToHtml($notification->data['content']),
|
||||
'time' => $notification->created_at->toDateTimeString(),
|
||||
]);
|
||||
$notification->refresh();
|
||||
|
@ -13,7 +13,7 @@ use Event;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Str;
|
||||
use Parsedown;
|
||||
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||
|
||||
class UserControllerTest extends TestCase
|
||||
{
|
||||
@ -35,7 +35,8 @@ class UserControllerTest extends TestCase
|
||||
$uid = $user->uid;
|
||||
factory(\App\Models\Player::class)->create(['uid' => $uid]);
|
||||
|
||||
$announcement = (new Parsedown())->text(option_localized('announcement'));
|
||||
$converter = new GithubFlavoredMarkdownConverter();
|
||||
$announcement = $converter->convertToHtml(option_localized('announcement'));
|
||||
$this->actingAs($user)
|
||||
->get('/user')
|
||||
->assertSee($announcement, false);
|
||||
|
Loading…
Reference in New Issue
Block a user