举例数据:
const content = {
"姓名": "zhangsan",
"name": "shkahsdhsa",
"2222": "22222"
}
页面展示:
格式化后展示:
实现代码
const content = {
"姓名": "zhangsan",
"name": "shkahsdhsa",
"2222": "22222"
}
const markdownContent = Object.entries(content)
.map(([key, value]) => ` ${key}: ${value}`)
.join('\n\n');
const showStr = `{\n\n${markdownContent}\n\n}`
标签:转换成,markdown,const,展示,shkahsdhsa,content,json,nbsp From: https://www.cnblogs.com/Zhang-jin/p/17999726