Skip to content

Commit

Permalink
Merge branch 'main' into @szymczak/migrate-to-npm
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekzaw committed Nov 14, 2024
2 parents 9ddce55 + c352064 commit 3c1cb95
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@expensify/react-native-live-markdown",
"version": "0.1.183",
"version": "0.1.184",
"description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
5 changes: 5 additions & 0 deletions parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import ExpensiMark from 'expensify-common/dist/ExpensiMark';
import {unescapeText} from './utils';

const MAX_PARSABLE_LENGTH = 4000;

type MarkdownType =
| 'bold'
| 'italic'
Expand Down Expand Up @@ -272,6 +274,9 @@ function groupRanges(ranges: MarkdownRange[]) {
}

function parseExpensiMarkToRanges(markdown: string): MarkdownRange[] {
if (markdown.length > MAX_PARSABLE_LENGTH) {
return [];
}
try {
const html = parseMarkdownToHTML(markdown);
const tokens = parseHTMLToTokens(html);
Expand Down
22 changes: 11 additions & 11 deletions parser/react-native-live-markdown-parser.js

Large diffs are not rendered by default.

0 comments on commit 3c1cb95

Please sign in to comment.