Allow articles to be uploaded from a .md file
This commit is contained in:
parent
e8965c7a1b
commit
8cf3d05543
4 changed files with 6 additions and 6 deletions
|
@ -53,10 +53,10 @@ class Article extends Model
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMainAttribute($value)
|
||||
public function getHtmlAttribute()
|
||||
{
|
||||
$markdown = new CommonMarkConverter();
|
||||
$html = $markdown->convertToHtml($value);
|
||||
$html = $markdown->convertToHtml($this->main);
|
||||
//change <pre><code>[lang] ~> <pre><code data-language="lang">
|
||||
$match = '/<pre><code>\[(.*)\]\n/';
|
||||
$replace = '<pre><code class="language-$1">';
|
||||
|
|
|
@ -8,7 +8,7 @@ Admin CP
|
|||
<h1>Hello {{ $name }}!</h1>
|
||||
|
||||
<h2>Articles</h2>
|
||||
<p>You can either <a href="/admin/articles/create">create</a> new blog posts, or <a href="/admin/articles/">edit</a> them.<p>
|
||||
<p>You can either <a href="/admin/blog/create">create</a> new blog posts, or <a href="/admin/blog/">edit</a> them.<p>
|
||||
|
||||
<h2>Notes</h2>
|
||||
<p>You can either <a href="/admin/notes/create">create</a> new notes, or <a href="/admin/notes/">edit</a> them.<p>
|
||||
|
|
|
@ -23,7 +23,7 @@ Articles «
|
|||
<span class="post-info">Posted <time class="dt-published" title="{{ $article->tooltip_time }}" datetime="{{ $article->w3c_time }}">{{ $article->human_time }}</time> - <a title="Permalink" href="{{ $article->link }}">⚓</a></span>
|
||||
</header>
|
||||
<div class="e-content">
|
||||
{!! $article['main'] !!}
|
||||
{!! $article->html !!}
|
||||
</div>
|
||||
</article>
|
||||
@endforeach
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<span class="post-info">Posted <time class="dt-published" title="{{ $article->tooltip_time }}" datetime="{{ $article->w3c_time }}">{{ $article->human_time }}</time> - <a title="Permalink" href="{{ $article->link }}">⚓</a></span>
|
||||
</header>
|
||||
<div class="e-content">
|
||||
{!! $article->main !!}
|
||||
{!! $article->html !!}
|
||||
</div>
|
||||
</article>
|
||||
@stop
|
||||
|
|
Loading…
Add table
Reference in a new issue