Didot generates files using templates with YAML, JSON, or XML sources via Scriban, Liquid, and more.
3.2K
Transform your structured YAML, JSON or XML data into beautiful, fully-customized HTML pages or plain text in seconds with Didot. This command-line tool allows you to seamlessly generate renders from data files using your preferred templates. Whether you're building static sites, documentation, or reporting tools, Didot makes it easy to turn raw data into polished, web-ready content.
Docker Installed: Ensure that Docker is installed and running on your system. You can download Docker from Docker's official site.
A pre-built Docker image is available on Docker Hub, you can pull it using the following command:
docker pull seddryck/didot:latest
Once you have the Docker image, you can run Didot using Docker in PowerShell.
CMD:
docker run --rm -v %cd%:/files didot -t <template-file> -s <source-file> -o <output-file>
PowerShell or Bash:
docker run --rm -v ${pwd}:/files didot -t <template-file> -s <source-file> -o <output-file>
--rm: Automatically removes the container after it finishes executing.-v ${pwd}:/files: Mounts the current directory (${pwd} in PowerShell or Bash, %cd% in CMD) to /files inside the Docker container, so Didot can access your local files.-t <template-file>: Specifies the path to the template file inside the /files directory.-s <source-file>: Specifies the path to the source file (YAML, JSON, or XML).-o <output-file>: Specifies the path to the output file that Didot will generate. If omitted, it will display the result on the host console../templates/template-01.hbs./data/data.jsondocker run --rm -v ${pwd}:/files didot -t /files/templates/template-01.hbs -s /files/data/data.json -o /files/output/output.txt
To update to the latest version of Didot, either pull the new Docker image
docker pull seddryck/didot:latest
Didot is a command-line tool designed for generating files based on templating. It supports YAML, JSON, and XML as source data formats and provides flexibility in templating through both Scriban, Liquid, Handlebars, StringTemplate and SmartFormat templates languages. With Didot, you can easily automate file generation by combining structured data from YAML, JSON, or XML files with customizable templates using Scriban or Liquid.
.yaml or .yml extension are parsed using a YAML source parser..json extension are parsed using a JSON source parser..xml extension are parsed using an XML source parser..md extension are parsed using an YAML parser for the FrontMatter and the Markdown content is added in the entry content.Didot utilizes some templating engines, which allow for powerful and flexible templating.
.scriban extension are parsed using a Scriban template engine. Scriban is a lightweight and fast template engine with rich support for multiple output formats.
.liquid extension are parsed using a dotLiquid template engine. DotLiquid is a .NET port of the Liquid templating engine used by platforms like Shopify.
.hbs extension are parsed using a Handlebars template engine. Handlebars C# port of the popular JavaScript Handlebars templating engine.
.smart extension are parsed using a SmartFormat template engine. SmartFormat.Net is a A lightweight templating engine primarily used for string formatting.
.st and .stg extension are parsed using the StringTemplate engine. StringTemplate is a powerful template engine specifically designed to enforce strict separation of logic from presentation.
The command to run Didot is simply didot. When executing it, you need to provide three required arguments:
-t, --template (required): Specifies the path to the Scriban, Liquid, Handlebars, StringTemplate or SmartFormat template file.-s, --source: Specifies the path to the source data file, which can be in YAML, JSON, or XML format. If this argument is not provided, the data will be read from the console input. In such cases, the -r, --parser option becomes mandatory.-o, --output: Specifies the path to the output file where the generated content will be saved. If not provided, the output will be displayed directly in the console.Example:
didot -t template.scriban -s data.yaml -o page.html
In this example:
template.scriban is the Scriban template file.data.yaml is the source file containing the structured data in YAML format.page.html is the output file that will contain the generated content.-t--template-t path/to/template or --template=path/to/template-e--engine-e fluid or --engine=fluid-x--engine-extension-x txt:handlebars;liquid:fluid or --engine-extension=.txt:handlebars;liquid:fluid-s--source--StdIn-s path/to/source or --source=path/to/source or --source=foo:path/to/source1;bar:path/to/source1-r--parser--stdin is specified. When omitted Didot will select the parser based on the extension of the source file-r YAML or --parser=YAML-X--parser-extension-X txt:yaml;dat:json or --parser-extension=txt:yaml;dat:json-i--stdin--source and must specified to false when --source is not provided.-i or --stdin or --stdin false-o--output-o path/to/output or --output=path/to/outputdidot -t template.scriban -s data.yaml -o page.html
In this example:
template.scriban is the Scriban template file.data.yaml is the source file containing the structured data in YAML format.page.html is the output file that will contain the generated content.CMD:
type "data.json" | didot --stdin -t template.hbs -r json
PowerShell:
Get-Content data.json | didot --stdin -t template.hbs -r json
Bash:
cat data.json | didot --stdin -t template.hbs -r json
In this example:
template.hbs is the Handlebars template file.json is the parser of input data.Make sure that the template file and source file are correctly formatted and aligned with your data model to produce the desired result.
Content type
Image
Digest
sha256:c2c515190…
Size
79.3 MB
Last updated
1 day ago
docker pull seddryck/didot