我有一些降价文件,我想将它们显示在我由 Laravel 开发的博客上。
所以我想出了这样一个解决方案:
控制器
public function display() {
$pd = new Parsedown();
$text = Storage::disk('local')->get('x.md');
$html = $pd->text($text);
$title = "title";
return view('x.y', [
"html" => $html,
"title" => $title
]);
}
刀
<div class="container-fluid">
<div class="row">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title text-center">{{ $title }}</h3>
</div>
<div class="panel-body">
{!! $html !!}
</div>
</div>
</div>
</div>
它运行良好,除了table
元素:
Parsedown
像这样解析表:
header 1 | header 2
-------- | --------
cell 1.1 | cell 1.2
cell 2.1 | cell 2.2
进入:
<table>
<thead>
<tr>
<th>header 1</th>
<th>header 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>cell 1.1</td>
<td>cell 1.2</td>
</tr>
<tr>
<td>cell 2.1</td>
<td>cell 2.2</td>
</tr>
</tbody>
</table>
然后我得到了一张没有引导样式的表,看起来很奇怪。我想要得到的是:
<table class="table">
...
</table>
那么,有人可以给我一些建议吗?