Add mustache template rendering support to parsers #685
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds support for rendering mustache templates in the parsers module. It includes changes to the
parsers.ts
file, where a newmustache
function is added. This function takes a text string or a WorkspaceFile and data as input and returns the rendered template as a string. This feature enhances the functionality of the parsers module by allowing the rendering of dynamic content using mustache templates.📝 A new constant,
mustacheRender
, is exported from the module located atpackages/core/src/mustache.ts
. This seems to be wrapping the render function of Mustache, a logic-less template syntax.🧩 In
packages/core/src/parsers.ts
,mustacheRender
is imported from the mustache module. This adds a new functionality to thecreateParsers
function. Specifically, it introduces the ability to render mustache templates. The function utilizesmustacheRender
, applied on the content of a file (f
) with suppliedargs
.👥 From a user perspective, a new method has been defined in the public API
packages/core/src/types/prompt_template.d.ts
. The method,mustache
, allows users to render mustache templates by passing a string or a file as a template and a record object as data. This change enhances the public API, giving more flexibility and tools to the users.These changes show the focus on enhancing the template rendering capabilities of the system. By incorporating Mustache, template rendering becomes more flexible and powerful. 🚀