{"id":19990717,"url":"https://github.com/Handlebars-Net/Handlebars.Net.Helpers","last_synced_at":"2025-05-04T09:36:41.315Z","repository":{"id":41855831,"uuid":"248295894","full_name":"Handlebars-Net/Handlebars.Net.Helpers","owner":"Handlebars-Net","description":"Handlebars.Net helpers in the categories: 'Boolean', 'Constants', 'Enumerable', 'Environment', 'Math', 'Regex', 'String', 'DateTime' and 'Url'.","archived":false,"fork":false,"pushed_at":"2025-04-16T20:17:15.000Z","size":723,"stargazers_count":52,"open_issues_count":5,"forks_count":21,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-16T21:01:15.551Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Handlebars-Net.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["StefH"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://www.paypal.me/stefheyenrath"}},"created_at":"2020-03-18T17:17:26.000Z","updated_at":"2025-04-15T08:22:27.000Z","dependencies_parsed_at":"2023-12-20T17:43:32.303Z","dependency_job_id":"88319329-8f03-4560-80d7-8a2d9fe194e7","html_url":"https://github.com/Handlebars-Net/Handlebars.Net.Helpers","commit_stats":{"total_commits":206,"total_committers":11,"mean_commits":"18.727272727272727","dds":0.3932038834951457,"last_synced_commit":"f738aa511ee8e07a0f8a9ca49491b679c9765323"},"previous_names":["stefh/handlebars.net.helpers"],"tags_count":59,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Handlebars-Net%2FHandlebars.Net.Helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Handlebars-Net%2FHandlebars.Net.Helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Handlebars-Net%2FHandlebars.Net.Helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Handlebars-Net%2FHandlebars.Net.Helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Handlebars-Net","download_url":"https://codeload.github.com/Handlebars-Net/Handlebars.Net.Helpers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252317004,"owners_count":21728521,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T04:51:26.215Z","updated_at":"2025-05-04T09:36:41.306Z","avatar_url":"https://github.com/Handlebars-Net.png","language":"C#","readme":"﻿# Handlebars.Net.Helpers\r\nSeveral helpers which can be used for [Handlebars.Net](https://github.com/rexm/Handlebars.Net)\r\n\r\n## Project\r\n| | |\r\n| --- | --- |\r\n| **Build Azure** | [![Build Status Azure](https://dev.azure.com/stef/Handlebars.Net.Helpers/_apis/build/status/CI?branchName=master)](https://dev.azure.com/stef/Handlebars.Net.Helpers/_build/latest?definitionId=36\u0026branchName=master) |\r\n| **Sonar Quality** | [![Sonar Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=Handlebars.Net.Helpers\u0026metric=alert_status)](https://sonarcloud.io/project/issues?id=Handlebars.Net.Helpers) [![Sonar Bugs](https://sonarcloud.io/api/project_badges/measure?project=Handlebars.Net.Helpers\u0026metric=bugs)](https://sonarcloud.io/project/issues?id=Handlebars.Net.Helpers\u0026resolved=false\u0026types=BUG) [![Sonar Code Smells](https://sonarcloud.io/api/project_badges/measure?project=Handlebars.Net.Helpers\u0026metric=code_smells)](https://sonarcloud.io/project/issues?id=Handlebars.Net.Helpers\u0026resolved=false\u0026types=CODE_SMELL)|\r\n| **Coverage** | [![Sonar Coverage](https://sonarcloud.io/api/project_badges/measure?project=Handlebars.Net.Helpers\u0026metric=coverage)](https://sonarcloud.io/component_measures?id=Handlebars.Net.Helpers\u0026metric=coverage) [![codecov](https://codecov.io/gh/StefH/Handlebars.Net.Helpers/branch/master/graph/badge.svg)](https://codecov.io/gh/StefH/Handlebars.Net.Helpers) |\r\n\r\n## Packages\r\n\r\n| Package | Nuget | MyGet [:information_source:](https://github.com/StefH/Handlebars.Net.Helpers/wiki/MyGet) |\r\n| --- | --- | --- |\r\n| Handlebars.Net.Helpers |[![NuGet](https://img.shields.io/nuget/v/Handlebars.Net.Helpers)](https://www.nuget.org/packages/Handlebars.Net.Helpers) | [![MyGet](https://img.shields.io/myget/handlebars_net_helpers/vpre/Handlebars.Net.Helpers?label=MyGet)](https://www.myget.org/feed/handlebars_net_helpers/package/nuget/Handlebars.Net.Helpers)|\r\n| Handlebars.Net.Helpers.DynamicLinq |[![NuGet](https://img.shields.io/nuget/v/Handlebars.Net.Helpers.DynamicLinq)](https://www.nuget.org/packages/Handlebars.Net.Helpers.DynamicLinq) | [![MyGet](https://img.shields.io/myget/handlebars_net_helpers/vpre/Handlebars.Net.Helpers.DynamicLinq?label=MyGet)](https://www.myget.org/feed/handlebars_net_helpers/package/nuget/Handlebars.Net.Helpers.DynamicLinq)|\r\n| Handlebars.Net.Helpers.Humanizer |[![NuGet](https://img.shields.io/nuget/v/Handlebars.Net.Helpers.Humanizer)](https://www.nuget.org/packages/Handlebars.Net.Helpers.Humanizer) | [![MyGet](https://img.shields.io/myget/handlebars_net_helpers/vpre/Handlebars.Net.Helpers.Humanizer?label=MyGet)](https://www.myget.org/feed/handlebars_net_helpers/package/nuget/Handlebars.Net.Helpers.Humanizer)|\r\n| Handlebars.Net.Helpers.Json |[![NuGet](https://img.shields.io/nuget/v/Handlebars.Net.Helpers.Json)](https://www.nuget.org/packages/Handlebars.Net.Helpers.Json) | [![MyGet](https://img.shields.io/myget/handlebars_net_helpers/vpre/Handlebars.Net.Helpers.Json?label=MyGet)](https://www.myget.org/feed/handlebars_net_helpers/package/nuget/Handlebars.Net.Helpers.Json)|\r\n| Handlebars.Net.Helpers.Random |[![NuGet](https://img.shields.io/nuget/v/Handlebars.Net.Helpers.Random)](https://www.nuget.org/packages/Handlebars.Net.Helpers.Random) | [![MyGet](https://img.shields.io/myget/handlebars_net_helpers/vpre/Handlebars.Net.Helpers.Random?label=MyGet)](https://www.myget.org/feed/handlebars_net_helpers/package/nuget/Handlebars.Net.Helpers.Random)|\r\n| Handlebars.Net.Helpers.Xeger |[![NuGet](https://img.shields.io/nuget/v/Handlebars.Net.Helpers.Xeger)](https://www.nuget.org/packages/Handlebars.Net.Helpers.Xeger) | [![MyGet](https://img.shields.io/myget/handlebars_net_helpers/vpre/Handlebars.Net.Helpers.Xeger?label=MyGet)](https://www.myget.org/feed/handlebars_net_helpers/package/nuget/Handlebars.Net.Helpers.Xeger)|\r\n| Handlebars.Net.Helpers.XPath |[![NuGet](https://img.shields.io/nuget/v/Handlebars.Net.Helpers.XPath)](https://www.nuget.org/packages/Handlebars.Net.Helpers.XPath) | [![MyGet](https://img.shields.io/myget/handlebars_net_helpers/vpre/Handlebars.Net.Helpers.XPath?label=MyGet)](https://www.myget.org/feed/handlebars_net_helpers/package/nuget/Handlebars.Net.Helpers.XPath)|\r\n| Handlebars.Net.Helpers.Xslt |[![NuGet](https://img.shields.io/nuget/v/Handlebars.Net.Helpers.Xslt)](https://www.nuget.org/packages/Handlebars.Net.Helpers.Xslt) | [![MyGet](https://img.shields.io/myget/handlebars_net_helpers/vpre/Handlebars.Net.Helpers.Xslt?label=MyGet)](https://www.myget.org/feed/handlebars_net_helpers/package/nuget/Handlebars.Net.Helpers.Xslt)|\r\n\r\n## Framework support\r\n- .NET Framework 4.5.1 4.5.2 and 4.6\r\n- .NET Standard 1.3, 2.0 and 2.1\r\n- .NET 6.0 and .NET 8.0\r\n\r\n## :exclamation: Breaking changes\r\n\r\n### 2.5.0\r\nSome breaking changes are introduced in this version:\r\n\r\n#### A. EnvironmentHelpers\r\nBy default, the category `Environment` is not automatically registered due to potential security issues.\r\nYou need to allow this via the HandlebarsHelpersOptions.\r\n\r\n#### B. System.Linq.Dynamic.Core\r\nBy default, the category `DynamicLinq` is not automatically registered due to [a CVE in System.Linq.Dynamic.Core DynamicLinq](https://github.com/zzzprojects/System.Linq.Dynamic.Core/issues/867).\r\nThis means that the NuGet *Handlebars.Net.Helpers.DynamicLinq* will not be loaded and registered automatically anymore. \r\nYou need to allow this via the HandlebarsHelpersOptions. In addition, an extra configuration setting is added to allow the use of `ToString` and `Equals` on an `object`.\r\n\r\nExample:\r\n``` c#\r\nvar handlebarsContext = HandlebarsDotNet.Handlebars.Create();\r\nHandlebarsHelpers.Register(handlebarsContext, o =\u003e\r\n{\r\n    o.DynamicLinqHelperOptions = new HandlebarsDynamicLinqHelperOptions\r\n    {\r\n        AllowEqualsAndToStringMethodsOnObject = true\r\n    };\r\n});\r\n```\r\n\r\n## Usage\r\n\r\n### Register\r\n\r\n#### Get all helpers\r\n``` c#\r\nvar handlebarsContext = HandlebarsDotNet.Handlebars.Create();\r\nHandlebarsHelpers.Register(handlebarsContext);\r\n```\r\n\r\n#### Get a specific helper\r\n``` c#\r\nvar handlebarsContext = HandlebarsDotNet.Handlebars.Create();\r\nHandlebarsHelpers.Register(handlebarsContext, Category.String);\r\n```\r\n\r\n#### Get multiple helpers\r\n``` c#\r\nvar handlebarsContext = HandlebarsDotNet.Handlebars.Create();\r\nHandlebarsHelpers.Register(handlebarsContext, Category.Math, Category.String);\r\n```\r\n\r\n### Using\r\n\r\n#### With a category prefix (default)\r\nBy default you can use the helpers by using a prefix from the category:\r\n``` handlebars\r\n{{[String.Append] \"foobar\" \"bar\"}}\r\n```\r\n\r\n#### With an additional custom prefix\r\nIf you would like to use the helpers with a custom prefix, you need to register the helpers using this code:\r\n``` c#\r\nHandlebarsHelpers.Register(handlebarsContext, options =\u003e { Prefix = \"custom\"; });\r\n```\r\n\r\nNow you can only access the helpers by using the custom prefix, category prefix and the name like:\r\n```handlebars\r\n{{[custom.String.Append] \"foobar\" \"bar\"}}\r\n```\r\n\r\n#### With a custom prefix separator character\r\nBy default the dot (`.`) character is used, use the code below to use a different value:\r\n\r\n``` c#\r\nHandlebarsHelpers.Register(handlebarsContext, options =\u003e { PrefixSeparator = \"-\"; });\r\n```\r\n\r\nNow you can only access the helpers by using the `-` separator like this:\r\n```handlebars\r\n{{[String-Append] \"foobar\" \"bar\"}}\r\n```\r\n\r\n#### Without a prefix\r\nIf you would like to use the helpers without a prefix, so just by name, use this code:\r\n``` c#\r\nHandlebarsHelpers.Register(handlebarsContext, options =\u003e { UseCategoryPrefix = false; });\r\n```\r\n\r\nNow you can use it like:\r\n``` handlebars\r\n{{String-Append \"foobar\" \"bar\"}}\r\n```\r\n\r\nNow you can access the helpers by just using the name like:\r\n```handlebars\r\n{{Append \"foobar\" \"bar\"}}\r\n```\r\n\r\n***\r\n\r\nThe following default built-in helpers are available:\r\n- [Boolean](https://github.com/StefH/Handlebars.Net.Helpers/wiki/Boolean)\r\n- [DateTime](https://github.com/StefH/Handlebars.Net.Helpers/wiki/DateTime)\r\n- [Dictionary](https://github.com/StefH/Handlebars.Net.Helpers/wiki/Dictionary)\r\n- [Constants](https://github.com/StefH/Handlebars.Net.Helpers/wiki/Constants)\r\n- [Enumerable](https://github.com/StefH/Handlebars.Net.Helpers/wiki/Enumerable)\r\n- [Environment](https://github.com/StefH/Handlebars.Net.Helpers/wiki/Environment) [🔺](#a-environmenthelpers)\r\n- [Math](https://github.com/StefH/Handlebars.Net.Helpers/wiki/Math)\r\n- [Regex](https://github.com/StefH/Handlebars.Net.Helpers/wiki/Regex)\r\n- [String](https://github.com/StefH/Handlebars.Net.Helpers/wiki/String)\r\n- [Url](https://github.com/StefH/Handlebars.Net.Helpers/wiki/Url)\r\n\r\nAnd the following additonal helpers are available:\r\n- [DynamicLinq](https://github.com/Handlebars-Net/Handlebars.Net.Helpers/wiki/DynamicLinq) [🔺](#b-systemlinqdynamiccore)\r\n- [Humanizer](https://github.com/Handlebars-Net/Handlebars.Net.Helpers/wiki/Humanizer)\r\n- [Json](https://github.com/Handlebars-Net/Handlebars.Net.Helpers/wiki/Json)\r\n- [Random](https://github.com/Handlebars-Net/Handlebars.Net.Helpers/wiki/Random)\r\n- [Xeger](https://github.com/Handlebars-Net/Handlebars.Net.Helpers/wiki/Xeger)\r\n- [XPath](https://github.com/Handlebars-Net/Handlebars.Net.Helpers/wiki/XPath)\r\n- [Xslt](https://github.com/Handlebars-Net/Handlebars.Net.Helpers/wiki/Xslt)\r\n\r\n***\r\n## References\r\n- Thanks to https://github.com/rexm/Handlebars.Net\r\n- Some ideas based on https://github.com/helpers/handlebars-helpers\r\n- Some code based on https://www.30secondsofcode.org/c-sharp/t/string/p/1\r\n- Some documentation based on https://github.com/arinet/HandlebarDocs\r\n- SimpleJson copied from (https://github.com/facebook-csharp-sdk/simple-json)\r\n\r\n\r\n## Example\r\n- Static WebAssembly WebSite on GitHub Pages: [handlebars-net.github.io/Handlebars.Net.Helpers](https://handlebars-net.github.io/Handlebars.Net.Helpers/)\r\n  \u003cbr\u003eCreated with [Abies](https://github.com/Picea/Abies).","funding_links":["https://github.com/sponsors/StefH","https://www.paypal.me/stefheyenrath"],"categories":["C\\#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHandlebars-Net%2FHandlebars.Net.Helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHandlebars-Net%2FHandlebars.Net.Helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHandlebars-Net%2FHandlebars.Net.Helpers/lists"}