Skip to content

refactor: add optional max length to parse expensimark - #775

Merged
JS00001 merged 4 commits into
Expensify:mainfrom
Uzaifm127:refactor/add-optional-max-length-to-parse-expensimark
Sep 4, 2026
Merged

JS00001 merged 4 commits into
Expensify:mainfrom
Uzaifm127:refactor/add-optional-max-length-to-parse-expensimark

Conversation

@Uzaifm127

@Uzaifm127 Uzaifm127 commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Details

parseExpensiMark() uses ExpensiMark from expensify-common to convert Markdown into formatted ranges.

This PR makes the parser length configurable while keeping the existing 4,000-character limit as the default by adding an optional argument to parseExpensiMark function. It also updates expensify-common to 2.0.201, which contains the optimized ExpensiMark implementation required by this parser.

Related Issues

Expensify/App#95210

Manual Tests

N/A

Linked PRs

@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Uzaifm127

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

exfy-clabot Bot added a commit to Expensify/CLA that referenced this pull request Sep 3, 2026
@Uzaifm127

Copy link
Copy Markdown
Contributor Author

@linhvovan29546

Do we need the QA for this PR?

I think we don't need it. We can test this in react-native-live-markdown/example app by modifying the MAX_PARSABLE_LENGTH from code. We can do the QA in version bump PR of Expensify/App repo.


@JS00001

Do we need to update the README.md for this change? like the following:

The built-in `parseExpensiMark` parser accepts an optional `maxLength` argument. It defaults to 4,000 characters, so existing callers keep the current bounded behavior. Applications that have a different safe limit can pass that limit explicitly from a worklet parser:

function parser(input: string) {
  'worklet';

  return parseExpensiMark(input, 10000);
}

@linhvovan29546

Copy link
Copy Markdown

Do we need to update the README.md for this change? like the following:

I think we should

@linhvovan29546 linhvovan29546 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor NIT #775 (comment). All good

Comment thread src/parseExpensiMark.ts
Explain the default and configurable input lengths and require expensify-common 2.0.201 or newer.
@Uzaifm127

Copy link
Copy Markdown
Contributor Author

Updated the README.md file

@linhvovan29546

Copy link
Copy Markdown

@JS00001 All yours.

@JS00001
JS00001 merged commit e1a3808 into Expensify:main Sep 4, 2026
9 of 11 checks passed
@os-botify

os-botify Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Published to npm in 0.1.337 🎉

@JS00001

JS00001 commented Sep 4, 2026

Copy link
Copy Markdown

@Uzaifm127 I think we need one more PR to use the new version, right?

@Uzaifm127

Copy link
Copy Markdown
Contributor Author

@JS00001 Yes we need one more App PR in which we will be doing the version bump and passing the MAX_MARKUP_LENGTH as limit to parseExpensiMark function.

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.

4 participants