使用 for 循环在降价内的相同 table 内生成 table 行

use for loop to generate table row within the same table inside markdown

我是 Markdown 的新手,使用 markdown 语法创建了一个 table,但我的要求是创建一个 table,标题只有一次,行应该动态地取值和行应该是多个。

这是我的代码:

{  
         "table":{  
            "headers":[  
               "Date & Time",
               "Location",
               "Status of Item"
            ],

            "rows":[  
               [  
                  counter1,
                  counter2,
                  counter3 +"\n"
               ],

            ]
         }
      }

这里,行应该在这里循环。

因为你在 nodejs 中,你可以轻松地使用 javascript 来修改 json:

 jsonobj={
  table:{  
        headers:[  
           "Date & Time",
           "Location",
           "Status of Item"
        ],
        rows:[]
    }
  };
for(i=0;i<10;i++){
jsonobj.table.rows.push([["12:30", "England","existing"]]);
}
console.log(json2md(jsonobj));

基础知识可以在这里找到:https://github.com/IonicaBizau/json2md