handlebars-lang / handlebars-lang/handlebars.js

Option for custom escaping function in `Handlebars.compile`

Open
#1,746 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
JavaScript
Stars
18.7k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

Handlebars.compile allows to disable HTML escaping via noEscape but I'm looking for more control over the escaping to support arbitrary output formats with their own escaping rules.

I'd propose a new escapeExpression option on Handlebars.compile which takes a function that will do the escaping in place of Handlebars.escapeExpression.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Handlebars.compile and Handlebars.escapeExpression entry points, and inspect how the existing noEscape option changes escaping. Define the callback behavior and verify that compiled templates use the supplied function instead of the default escaping; the payload does not name a test file.

Written by the indexing model from the issue text.

Assessment

Tech stack
handlebars, javascript
Domain
web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.