add markdown toc
parent
04687998d6
commit
c9dec3b8b1
|
@ -23,8 +23,13 @@ class Blog extends Controller
|
|||
$obj['content'] = $value['content'];
|
||||
$obj['type'] = $value['type'];
|
||||
//数据加工
|
||||
$markdown = new Parsedown;
|
||||
$content = $markdown->text($value['content']);
|
||||
// $markdown = new Parsedown;
|
||||
// $content = $markdown->text($value['content']);
|
||||
|
||||
$Parsedown = new \ParsedownToC();
|
||||
$content = $Parsedown->body($value['content']);
|
||||
// $content = $Parsedown->contentsList();
|
||||
|
||||
$obj['content'] = $content;
|
||||
array_push($firstpagedocs,$obj);
|
||||
}
|
||||
|
@ -57,8 +62,12 @@ class Blog extends Controller
|
|||
$commentModel = new Models\DocComment();
|
||||
$doc = $docModel->titleDoc(rawurldecode( $this->querys['title']));
|
||||
$id = $doc[0]["id"];
|
||||
$markdown = new Parsedown;
|
||||
$content = $markdown->text($doc[0]['content']);
|
||||
// $markdown = new Parsedown;
|
||||
// $content = $markdown->text($doc[0]['content']);
|
||||
$Parsedown = new \ParsedownToC();
|
||||
$content = $Parsedown->body($doc[0]['content']);
|
||||
$toc = $Parsedown->contentsList();
|
||||
|
||||
$typedocs = $docModel->getAllTypeDocs();
|
||||
$doccoment = $commentModel->DocComments($id);
|
||||
$titles = $docModel->AllTitle();
|
||||
|
@ -71,6 +80,7 @@ class Blog extends Controller
|
|||
'title'=>rawurldecode($this->querys['title']),
|
||||
'index'=>false,
|
||||
'content'=>$content,
|
||||
'toc'=>$toc,
|
||||
'type' => $this->querys['type'],
|
||||
'debug' => true,
|
||||
'article'=>true,
|
||||
|
@ -87,6 +97,7 @@ class Blog extends Controller
|
|||
'title'=>rawurldecode($this->querys['title']),
|
||||
'article'=>true,
|
||||
'content'=>$content,
|
||||
'toc'=>$toc,
|
||||
'type' => $this->querys['type'],
|
||||
"typedocs" => $typedocs,
|
||||
"comments" => $doccoment,
|
||||
|
|
|
@ -82,8 +82,9 @@ class NewUi extends Controller
|
|||
$groupstype = $docModel->GetAllGroupType();
|
||||
|
||||
$fisrtpage = $docModel->pageDoc(5,0,55);
|
||||
$markdown = new Parsedown;
|
||||
$doc[0]['content'] = $markdown->text($doc[0]['content']);
|
||||
$markdown = new \ParsedownToC();
|
||||
$doc[0]['content'] = $markdown->body($doc[0]['content']);
|
||||
$doc[0]['toc'] = $markdown->contentsList();
|
||||
$top5 = $docModel->top5Doc();
|
||||
|
||||
foreach ($fisrtpage as $key => $value) {
|
||||
|
@ -92,7 +93,7 @@ class NewUi extends Controller
|
|||
$obj['content'] = $value['content'];
|
||||
$obj['type'] = $value['type'];
|
||||
//数据加工
|
||||
$content = $markdown->text($value['content']);
|
||||
$content = $markdown->body($value['content']);
|
||||
$obj['content'] = $content;
|
||||
array_push($firstpagedocs,$obj);
|
||||
}
|
||||
|
@ -141,8 +142,9 @@ class NewUi extends Controller
|
|||
$commentModel = new Models\DocComment();
|
||||
$doc = $docModel->titleDoc(rawurldecode($this->querys['title']));
|
||||
$id = $doc[0]["id"];
|
||||
$markdown = new Parsedown;
|
||||
$doc[0]['content'] = $markdown->text($doc[0]['content']);
|
||||
$markdown = new \ParsedownToC();
|
||||
$doc[0]['content'] = $markdown->body($doc[0]['content']);
|
||||
|
||||
$typedocs = $docModel->getAllTypeDocs();
|
||||
$doccoment = $commentModel->DocComments($id);
|
||||
$titles = $docModel->AllTitle();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<title>{{ title }}</title>
|
||||
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
|
@ -13,6 +13,14 @@
|
|||
<script src="/api/App/Views/blog/js//jquery-editable-select.min.js"></script>
|
||||
<script src="/api/App/Views/blog/js//bootstrap-treeview.min.js"></script>
|
||||
<link href="/api/App/Views/blog/css/jquery-editable-select.min.css" rel="stylesheet">
|
||||
<style type="text/css">
|
||||
#doc_toc ul {
|
||||
margin-left: -15px;
|
||||
}
|
||||
#doc_toc ul li {
|
||||
color: #8e846b;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body style="background: #eee">
|
||||
|
@ -148,7 +156,11 @@
|
|||
<!--评论列表显示区end-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1" style="padding: 0px;margin-left: -10px; " id="doc_toc" >
|
||||
{{ doc.toc| raw }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<ul class="pagination" style="margin-left: 50%" id="pagenation">
|
||||
<li><a href="#">«</a></li>
|
||||
|
@ -219,7 +231,6 @@
|
|||
});
|
||||
}
|
||||
function loadtypedoc(data){
|
||||
console.log(data.href.split("#")[1].split("doc_type_")[1]);
|
||||
chosetype = data.href.split("#")[1].split("doc_type_")[1];
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
|
@ -274,7 +285,9 @@
|
|||
{
|
||||
if(globalposx > 250){
|
||||
$('#grouptab').fadeOut(1000);
|
||||
$('#doc_toc').fadeIn(1000);
|
||||
}
|
||||
|
||||
}
|
||||
$(document).ready(
|
||||
function () {
|
||||
|
@ -311,7 +324,8 @@
|
|||
|
||||
$(document).mousemove(function(e){
|
||||
if(e.pageX < 250){
|
||||
$('#grouptab').fadeIn(2000);
|
||||
$('#grouptab').fadeIn(1500);
|
||||
$('#doc_toc').fadeOut(1000);
|
||||
}
|
||||
if(e.pageX < 400){
|
||||
$('#doctype').fadeIn(2000);
|
||||
|
|
|
@ -11,6 +11,12 @@
|
|||
<script src="/api/App/Views/blog/js//jquery-editable-select.min.js"></script>
|
||||
<script src="/api/App/Views/blog/js//bootstrap-treeview.min.js"></script>
|
||||
<link href="/api/App/Views/blog/css/jquery-editable-select.min.css" rel="stylesheet">
|
||||
<script type="text/css">
|
||||
#doc_toc > ul{
|
||||
margin-left: -30px;
|
||||
color: black;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body style="background: #eee">
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
"require": {
|
||||
"twig/twig": "~2.0",
|
||||
"propel/propel": "~2.0@dev",
|
||||
"erusev/parsedown": "^1.7"
|
||||
"erusev/parsedown": "^1.7",
|
||||
"hoegh/parsedown-toc": "^1.3"
|
||||
},
|
||||
"repositories": {
|
||||
"packagist": {
|
||||
"type": "composer",
|
||||
"url": "https://packagist.phpcomposer.com"
|
||||
"url": "https://mirrors.aliyun.com/composer/"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
|
Loading…
Reference in New Issue