Server-side HTML Tables
Output Readme Download Replit Sel. & Copy Full


Create HTML tables server-side with nunjucks. This repl pre-renders the HTML file so that it can be served as a static file, but the server code can be adjusted to render tables on the fly if they need to be customized.

To view on Triplelog, click here.


The index.js file generates the HTML file with the tables when the server starts. Then the server serves this static file when someone visits the site. You might want to do something different, but you can move the code wherever it works for your purposes.

There is a table object with arrays for head and body. If your data is in a different format, you will likely need something to convert or modify the process. Then there is a template string for just the table. You can combine this template with the template.html, create a new template file that extends, or whatever makes sense.

HTML template

There is a template.html file with a block for the table. The nunjucks syntax is relatively simple to learn and can help create pretty much anything.