Skip to content

Fix undefined variable in README example code#62

Open
hobostay wants to merge 1 commit intochenglou:mainfrom
hobostay:fix-readme-textwidth-variable
Open

Fix undefined variable in README example code#62
hobostay wants to merge 1 commit intochenglou:mainfrom
hobostay:fix-readme-textwidth-variable

Conversation

@hobostay
Copy link
Copy Markdown

Problem

The example code in the "Measure a paragraph's height" section (line 28) used an undefined variable textWidth:

const { height, lineCount } = layout(prepared, textWidth, 20)

This would cause a ReferenceError: textWidth is not defined if someone tries to run this code directly.

Solution

Changed the undefined variable to a concrete value (320) to match the other examples in the documentation that use 320px as the max width:

const { height, lineCount } = layout(prepared, 320, 20)

This makes the example code immediately runnable without modification.

Testing

The fix is purely documentation-only. No code changes were made.

The example code in the "Measure a paragraph's height" section used an
undefined variable `textWidth` which would cause a ReferenceError if run.
Changed it to a concrete value (320) matching the other examples in the doc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants