From 5d12e3b3f1cc0bfaa824f5f2dac818388bd7f46c Mon Sep 17 00:00:00 2001 From: Ryan Mark Date: Tue, 8 Sep 2026 15:58:31 -0700 Subject: [PATCH] Fix broken examples and typos in the README The Transformer example was not valid JS: both the asyncMap and asyncEach callbacks had a stray paren before their params, and the example called t.transform(), which is not a method on Transformer. The reverseInnerCoordinates example imported reverseInnerCoordinates from the package root and called extractTemplates(), neither of which is exported from src/index.js, and used a TS non-null assertion inside a js block. Rewritten against the public API, t.reverseInnerCoordinatesOf(). The documented unprocess output dropped the type import and the satisfies clause that the function actually preserves. Replaced with its real output. The package.json snippet was fenced as js, making it invalid JS. Also documents parseResultAt() and toStringWithTemplatePlaceholders(), which were missing from the method list, and fixes assorted prose typos. Co-Authored-By: Claude Opus 5 (1M context) --- README.md | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index db92007..ad8c976 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ npm add content-tag-utils Using from source / github, via package.json: -```js +```json { "dependencies": { "content-tag-utils": "github:NullVoxPopuli/content-tag-utils" @@ -46,7 +46,7 @@ import { unprocess } from 'content-tag-utils/unprocess'; ### Transformer -A general utility for working with content-tag, keeping tracked of each template as you apply transformations. +A general utility for working with content-tag, keeping track of each template as you apply transformations. Transformations are recorded and then applied later when calling `.toString()`. For example: @@ -63,7 +63,7 @@ export const Foo = '` ### transform + transformSync Transforms each template within a gjs or gts file in one go. -These are convenience functions that wraps the `Transformer`. +These are convenience functions that wrap the `Transformer`. The first argument to the callback will be the previous template-contents, and the second argument will be the coordinates of that template. @@ -127,7 +129,7 @@ let result = await transform(file, (contents, coordinates) => `${contents}!`); let result2 = transformSync(file, (contents, coordinates) => `${contents}!`); ``` -result / result 2 ( a ! character is added right before the closing ): +result / result 2 (a `!` character is added right before the closing ``): ```gjs export const Foo =