![](/img/trans.png)
[英]Jekyll: How to use for loop to generate table row within the same table inside markdown
[英]use for loop to generate table row within the same table inside markdown
我是Markdown的新手,使用markdown語法創建了一個表,但在這里我的要求是創建一個僅包含標題一次的表,並且行應動態獲取值,並且行應為多個。
這是我的代碼:
{
"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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.