Fix broken examples and typos in the README - #37
Merged
NullVoxPopuli merged 1 commit intoSep 8, 2026
Merged
Conversation
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) <noreply@anthropic.com>
NullVoxPopuli
approved these changes
Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Several of the README's examples don't run. Each fix here was verified by executing the example against
src/and comparing to the documented output.Broken syntax
Transformerexample had a stray paren before the params in both theasyncMapandasyncEachcallbacks ((contents, coordinates => {), so neither block was valid JS.package.jsonsnippet was fenced as ```js, which made it invalid JS.Wrong API
Transformerexample calledawait t.transform(...), which is not a method onTransformer. Changed tot.asyncMap().reverseInnerCoordinatesexample importedreverseInnerCoordinatesfrom the package root and calledextractTemplates(file). Neither is exported fromsrc/index.js,extractTemplateswas never imported in the example, andtemplateInfos[0]!is a TS non-null assertion inside a ```js block. Rewritten against the public API (t.reverseInnerCoordinatesOf(t.parseResults[0], innerCoordinates)) and the heading renamed to match the method that actually exists.Wrong documented output
unprocessexample claimed a result of justexport default <template>hi there</template>;. The function preserves the type import and thesatisfiesclause, so the result block now shows what it really returns.Docs gaps
t.parseResultAt(coordinates)andt.toStringWithTemplatePlaceholders()to the Properties / Methods list. ForparseResultAtthe non-obvious part is documented: a partial coordinates object works, and{ start },{ end }, or{ line, column }are each enough to match.closingTagvalue written as'</template'with no closing>.All 7 JS blocks in the README now pass
node --check; 3 of them failed before. Prettier,tsc --noEmit, and all 90 tests pass.🤖 Generated with Claude Code