diff --git a/exts/yapi-plugin-export-data/controller.js b/exts/yapi-plugin-export-data/controller.js
index 53d5fd4a..28e6ba02 100644
--- a/exts/yapi-plugin-export-data/controller.js
+++ b/exts/yapi-plugin-export-data/controller.js
@@ -80,7 +80,24 @@ class exportController extends baseController{
markdown.use(markdownItTableOfContents,{
markerPattern: /^\[toc\]/im
});
- let tp = defaultTheme + unescape(markdown.render(md));
+
+ let tp = defaultTheme + ``+ `` + unescape(markdown.render(md));
tp = createHtml5(tp);
return tp;
}
@@ -100,18 +117,20 @@ class exportController extends baseController{
return html;
}
function createBaseMessage(inter){
- // 基本信息
- let baseMessage = `### 基本信息\n\n**接口描述:**\n\n${inter.desc?escape(inter.desc):""}\n\n**接口名称:** ${inter.title}\n\n**接口路径:** ${curProject.basepath + inter.path}\n\n`;
+ // 基本信息
+ let baseMessage = `### 基本信息\n\n**接口名称:** ${inter.title}\n\n**接口路径:** ${curProject.basepath + inter.path}\n\n**接口描述:**\n${inter.desc?escape(inter.desc):""}\n`;
return baseMessage;
}
-
+ function replaceBr(str){
+ return str.replace("\n",escape("
"));
+ }
function createReqHeaders(req_headers){
// Request-headers
if(req_headers&&req_headers.length){
let headersTable = `**Headers:**\n\n`;
headersTable += `| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |\n| ------------ | ------------ | ------------ | ------------ | ------------ |\n`;
for(let j = 0;j `)}\n`;
// 基本信息
mdTemplate += createBaseMessage(interList[i]);
// Request
diff --git a/exts/yapi-plugin-export-data/defaultTheme.js b/exts/yapi-plugin-export-data/defaultTheme.js
index d70f2391..29b9c0d0 100644
--- a/exts/yapi-plugin-export-data/defaultTheme.js
+++ b/exts/yapi-plugin-export-data/defaultTheme.js
@@ -145,4 +145,73 @@ sup {
page-break-inside: avoid;
}
}
+html,body{
+ height: 100%;
+}
+.table-of-contents{
+ float: left;
+ width: 240px;
+ overflow: auto;
+ margin-left: -240px;
+ position: fixed;
+ padding-right: 0px;
+ box-sizing: border-box;
+ top: 0px;
+ bottom: 0px;
+ /* left: 0px; */
+ z-index: 3;
+}
+
+.table-of-contents ul{
+ overflow: auto;
+ margin: 0px;
+ height: 100%;
+ padding: 0px 0px;
+ box-sizing: border-box;
+
+}
+.table-of-contents ul li{
+ padding-left: 20px;
+}
+.table-of-contents ul:before{
+ content: "目录";
+ font-size: 16px;
+ padding: 10px 0px;
+ display: block;
+ line-height: 25px;
+ color:black;
+}
+
+.table-of-contents a{
+ padding: 2px 0px;
+ display: block;
+ text-decoration: none;
+
+}
+
+body>h2{
+ font-size: 30px;
+ padding: 10px 0px;
+}
+body>p{
+ margin-left: 30px;
+}
+body>table{
+ margin-left: 30px;
+}
+body>pre{
+ margin-left: 30px;
+}
+.curProject{
+ position: fixed;
+ top:20px;
+ font-size:25px;
+ color:black;
+ margin-left:-240px;
+ width:240px;
+ padding:5px;
+ line-height:25px;
+ box-sizing:border-box;
+}
+
`
\ No newline at end of file