算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
skill-023【设计与创意】A skill for creating dynamic HTML reports from JSON data, allowing users to visualize data in a web format with styling and structure.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
The HTML Report Generator skill enables users to convert JSON data into a structured and styled HTML report. This can be helpful for creating dashboards or reports that need to be shared in a web-friendly format.
Use the "Creating a new HTML report" workflow below.
To generate an HTML report, you can use a simple templating engine like Handlebars.js to create a visually appealing report.
Here is a basic example of how to create an HTML report:
const fs = require('fs');
const Handlebars = require('handlebars');
// Sample JSON data
const data = {
title: 'Monthly Sales Report',
sales: [
{ product: 'Widget A', amount: 300 },
{ product: 'Widget B', amount: 450 },
],
};
// HTML template
const template = `
<html>
<head><title>{{title}}</title></head>
<body>
<h1>{{title}}</h1>
<ul>
{{#each sales}}<li>{{product}}: {{amount}}</li>{{/each}}
</ul>
</body>
</html>
`;
// Compile the template
const compiledTemplate = Handlebars.compile(template);
// Generate the HTML report
const html = compiledTemplate(data);
// Write the HTML report to a file
fs.writeFileSync('report.html', html);
The HTML Report Generator skill provides a straightforward way to visualize and present JSON data in an accessible HTML format, making it ideal for web-based reporting.