Didot.Core
0.13.1
See the version list below for details.
dotnet add package Didot.Core --version 0.13.1
NuGet\Install-Package Didot.Core -Version 0.13.1
<PackageReference Include="Didot.Core" Version="0.13.1" />
paket add Didot.Core --version 0.13.1
#r "nuget: Didot.Core, 0.13.1"
// Install Didot.Core as a Cake Addin #addin nuget:?package=Didot.Core&version=0.13.1 // Install Didot.Core as a Cake Tool #tool nuget:?package=Didot.Core&version=0.13.1
Didot
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.
About | Installing | Quickstart
About
Continuous integration builds:
Installing
Install as a .NET global tool
A .NET global tool is a console application that you can install and run from any directory on your machine. Here’s a guide on how to perform a global installation of a .NET tool:
Prerequisites
Before installing a .NET global tool, you must have the .NET SDK installed on your machine. You can check if it's installed by running the following command in your terminal or Command Prompt:
dotnet --version
If .NET is not installed, download it from Microsoft's official website.
Install a .NET Global Tool
To install a .NET global tool, you use the dotnet tool install command. This command installs a tool for all users globally on your system.
dotnet tool install -g Didot-cli
-g
: This flag tells the dotnet command to install the tool globally.
Verify Installation
After installing the tool, you can verify that it's available globally by running it from any directory.
didot --version
This command will display the installed tool’s version if the installation was successful.
Update a .NET Global Tool
To update a globally installed .NET tool, use the dotnet tool update command:
dotnet tool update -g Didot-cli
Install from Docker
Prerequisites
Docker Installed: Ensure that Docker is installed and running on your system. You can download Docker from Docker's official site.
Pulling the Docker Image
A pre-built Docker image is available on Docker Hub, you can pull it using the following command:
docker pull seddryck/didot:latest
Running Didot from Docker
Once you have the Docker image, you can run Didot using Docker in PowerShell.
Basic Command
<sub>CMD:</sub>
docker run --rm -v %cd%:/files didot -t <template-file> -s <source-file> -o <output-file>
<sub>PowerShell:</sub>
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.
Example Workflow:
- Prepare the Template and Source Files:
- Make sure your template and source files are correctly formatted and saved in the correct directory. For example:
./templates/template-01.hbs
./data/data.json
- Run Didot: Use the following command to generate templated output:
docker run --rm -v ${pwd}:/files didot -t /files/templates/template-01.hbs -s /files/data/data.json -o /files/output/output.txt
- Access the Output: The output file will be generated in ./output/output.txt on your local machine after the Docker container finishes execution.
Updating Didot
To update to the latest version of Didot, either pull the new Docker image
docker pull seddryck/didot:latest
Install from GitHub Releases
Step 1: Download the ZIP from the GitHub Release
- Navigate to the GitHub repository of the project.
- Go to the Releases section, usually found under the "Code" tab.
- Download the
.zip
file containing the executable from the desired release.
Example:
https://github.com/Seddryck/Didot/releases/latest/
Step 2: Extract the ZIP File
- Right-click the downloaded
.zip
file and choose Extract All. - Extract the contents to a directory of your choice, such as
C:\Program Files\Didot
.
Tip: Choose a path that is easy to remember and doesn't contain special characters.
Step 3: Add the Executable to the System PATH
To run the executable from any location in the command line, you need to add its folder to your system's PATH.
- Open the Start Menu and search for Environment Variables.
- Click Edit the system environment variables.
- In the System Properties window, click Environment Variables.
- In the System Variables section, scroll down, select Path, and click Edit.
- In the Edit Environment Variable dialog, click New and enter the path to your extracted folder, e.g.,
C:\Program Files\Didot
. - Click OK to close all windows.
Step 4: Verify Installation
- Open Command Prompt (CMD).
- Type the name of the executable (e.g.,
didot.exe
) and hit Enter. - If everything is set up correctly, the program should run.
QuickStart
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.
Supported Data Formats:
- YAML: Files with the
.yaml
or.yml
extension are parsed using a YAML source parser. - JSON: Files with the
.json
extension are parsed using a JSON source parser. - XML: Files with the
.xml
extension are parsed using an XML source parser.
Supported Templating Engines:
Didot utilizes some templating engines, which allow for powerful and flexible templating.
- Scriban: Templates with the
.scriban
extension are parsed using a Scriban template engine. Scriban is a lightweight and fast template engine with rich support for multiple output formats.- Highly performant, designed to handle large-scale template processing.
- Supports customizable scripting with rich expressions and filters.
- Can work with JSON and YAML data sources.
- Typical Use Case: Config file generation, reports, email templates, or any templating scenario not tied to a specific web framework.
- Liquid: Templates with the
.liquid
extension are parsed using a dotLiquid template engine. DotLiquid is a .NET port of the Liquid templating engine used by platforms like Shopify.- Secure (no access to system objects), making it ideal for user-generated templates.
- Allows both dynamic and static templating.
- Supports filters, tags, and various control flow structures.
- Typical Use Case: SaaS applications, dynamic content rendering, email templates.
- Handlebars: Templates with the
.hbs
extension are parsed using a Handlebars template engine. Handlebars C# port of the popular JavaScript Handlebars templating engine.- Simple syntax for generating HTML or text files from templates.
- Support for helpers, partial templates, and block helpers.
- Good separation of logic from presentation.
- Typical Use Case: Email templates, reports, and content generation.
- SmartFormat: Templates with the
.smart
extension are parsed using a SmartFormat template engine. SmartFormat.Net is a A lightweight templating engine primarily used for string formatting.- Provides more advanced formatting capabilities than standard string formatting in C#.
- Supports nested templates, conditional formatting, and more.
- Typical Use Case: Log messages, report generation, and dynamic text formatting.
- StringTemplate: Templates with the
.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.- Focused on generating structured text, such as code, XML, and reports.
- Strong emphasis on enforcing Model-View separation.
- Supports conditionals, loops, and automatic escaping to prevent security issues.
- Typical Use Case: Code generation, configuration files, and situations where strict separation between logic and template is required.
Command Usage:
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-p, --Parser
option becomes mandatory.-i, --StdIn
: Specifies that the input is coming from the console. This option is required only when the --Source argument is omitted.-p, --Parser
: Defines the parser to use when the source data is provided through the console. Accepted values areyaml
,json
orxml
. This option is required only when the--Source
argument is omitted or if the extension of the source file is not recognized to determine the parser.-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:
With a source file:
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.
With data from the console:
<sub>CMD:</sub>
type data.json | didot --StdIn -t template.hbs -p json
<sub>PowerShell:</sub>
Get-Content data.json | didot --StdIn -t template.hbs -p json
<sub>Bash:</sub>
cat data.json | didot --StdIn -t template.hbs -p json
In this example:
template.hbs
is the Handlebars template file.json
is the parser of input data.- the output is redirected to the console.
Make sure that the template file and source file are correctly formatted and aligned with your data model to produce the desired result.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- Domemtech.StringTemplate4 (>= 4.3.0)
- DotLiquid (>= 2.2.692)
- Handlebars.Net (>= 2.1.6)
- Newtonsoft.Json (>= 13.0.3)
- Scriban (>= 5.10.0)
- SmartFormat.NET (>= 3.5.1)
- YamlDotNet (>= 16.1.3)
-
net8.0
- Domemtech.StringTemplate4 (>= 4.3.0)
- DotLiquid (>= 2.2.692)
- Handlebars.Net (>= 2.1.6)
- Newtonsoft.Json (>= 13.0.3)
- Scriban (>= 5.10.0)
- SmartFormat.NET (>= 3.5.1)
- YamlDotNet (>= 16.1.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.21.0 | 64 | 11/17/2024 |
0.20.0 | 67 | 10/29/2024 |
0.19.0 | 71 | 10/29/2024 |
0.18.0 | 81 | 10/27/2024 |
0.17.0 | 84 | 10/27/2024 |
0.16.0 | 75 | 10/26/2024 |
0.15.0 | 76 | 10/24/2024 |
0.14.0 | 76 | 10/24/2024 |
0.13.1 | 86 | 10/22/2024 |
0.13.0 | 71 | 10/21/2024 |
0.12.2 | 79 | 10/21/2024 |
0.12.1 | 79 | 10/21/2024 |
0.12.0 | 65 | 10/21/2024 |
0.11.0 | 108 | 10/20/2024 |
0.10.0 | 108 | 10/20/2024 |
0.9.0 | 96 | 10/20/2024 |
0.8.0 | 105 | 10/19/2024 |
0.7.0 | 98 | 10/19/2024 |
0.6.0 | 94 | 10/19/2024 |
0.5.1 | 115 | 10/19/2024 |
0.5.0 | 107 | 10/19/2024 |
0.4.0 | 119 | 10/19/2024 |
0.3.0 | 119 | 10/19/2024 |
0.2.0 | 112 | 10/19/2024 |
0.1.0 | 84 | 10/13/2024 |