Browse Source

add line feed for generating markdown

weichen 3 years ago
parent
commit
20aff546e8
1 changed files with 3 additions and 3 deletions
  1. 3 3
      backstage/static/js/editor.js

+ 3 - 3
backstage/static/js/editor.js

@@ -20,10 +20,10 @@ axios.get(contentApiUrl).then(({ data }) => {
       mdContent += frontMatter + '\n';
     }
     for (var idx=0; idx<blockArray.length; idx++) {
-      mdContent += `\n## **${_.get(blockArray[idx], 'title', '')}**`
+      mdContent += `\n### **${_.get(blockArray[idx], 'title', '')}**\n`
       for (var data of _.get(blockArray[idx], 'data', [])) {
         if (_.get(_.keys(data), 0) === 'description') {
-          mdContent += '\n' + _.get(data, 'description.text', '');
+          mdContent += `\n${_.get(data, 'description.text', '')}`;
         } else if (_.get(_.keys(data), 0) === 'image') {
           ampImgForm = `\n<amp-img\
 \n  alt="${_.get(data, 'image.alt', '小寶優居')}"\
@@ -31,7 +31,7 @@ axios.get(contentApiUrl).then(({ data }) => {
 \n  height="${_.get(data, 'image.height', 300)}"\
 \n  width="${_.get(data, 'image.width', 400)}"\
 \n  layout="${_.get(data, 'image.layout', 'responsive')}">\
-\n</amp-img>`;
+\n</amp-img>\n`;
           mdContent += ampImgForm;
         }
       }