Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump expensify-common to 2.0.10 #360

Merged
merged 18 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1111,12 +1111,12 @@ PODS:
- React-jsi (= 0.73.4)
- React-logger (= 0.73.4)
- React-perflogger (= 0.73.4)
- RNLiveMarkdown (0.1.54):
- RNLiveMarkdown (0.1.79):
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
- RNLiveMarkdown/common (= 0.1.54)
- RNLiveMarkdown/common (0.1.54):
- RNLiveMarkdown/common (= 0.1.79)
- RNLiveMarkdown/common (0.1.79):
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
Expand Down Expand Up @@ -1376,7 +1376,7 @@ SPEC CHECKSUMS:
React-runtimescheduler: ed48e5faac6751e66ee1261c4bd01643b436f112
React-utils: 6e5ad394416482ae21831050928ae27348f83487
ReactCommon: 840a955d37b7f3358554d819446bffcf624b2522
RNLiveMarkdown: 2f6f838a2089bd7337020a82800cb0c05c48c5d9
RNLiveMarkdown: a4ddf419a109cd3f916db22ee19f8b8293b4f7e4
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: 64cd2a583ead952b0315d5135bf39e053ae9be70

Expand Down
3 changes: 3 additions & 0 deletions parser/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["module:@react-native/babel-preset"]
}
10 changes: 4 additions & 6 deletions parser/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @ts-expect-error - to review how it's implemented in ExpensiMark
// eslint-disable-next-line import/no-unresolved
import {ExpensiMark} from 'expensify-common/lib/ExpensiMark';
import ExpensiMark from 'expensify-common/dist/ExpensiMark';
import _ from 'underscore';

type MarkdownType = 'bold' | 'italic' | 'strikethrough' | 'emoji' | 'mention-here' | 'mention-user' | 'mention-report' | 'link' | 'code' | 'pre' | 'blockquote' | 'h1' | 'syntax';
Expand All @@ -14,7 +13,7 @@ type Token = ['TEXT' | 'HTML', string];
type StackItem = {tag: string; children: Array<StackItem | string>};

function parseMarkdownToHTML(markdown: string): string {
const parser = ExpensiMark;
const parser = new ExpensiMark();
const html = parser.replace(markdown, {
tomekzaw marked this conversation as resolved.
Show resolved Hide resolved
shouldKeepRawInput: true,
});
Expand Down Expand Up @@ -155,10 +154,9 @@ function parseTreeToTextAndRanges(tree: StackItem): [string, Range[]] {
appendSyntax('# ');
addChildrenWithStyle(node, 'h1');
} else if (node.tag.startsWith('<pre')) {
const content = _.unescape(node.tag.match(/data-code-raw="([^"]*)"/)![1]!); // always present

appendSyntax('```');
addChildrenWithStyle(content, 'pre');
const content = node.children.join('').replaceAll('&#32;', ' ');
addChildrenWithStyle(`\n${content}`, 'pre');
appendSyntax('```');
} else if (node.tag.startsWith('<a href="')) {
const rawHref = node.tag.match(/href="([^"]*)"/)![1]!; // always present
Expand Down
11 changes: 6 additions & 5 deletions parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@
"main": "index.js",
"scripts": {
"test": "jest",
"build": "esbuild index.ts --bundle --minify --outfile=react-native-live-markdown-parser.js",
"run": "node react-native-live-markdown-parser.js",
"postinstall": "patch-package"
"build": "esbuild index.ts --bundle --outfile=build/index.esbuild.js && babel build/index.esbuild.js --out-file build/index.babel.js && esbuild build/index.babel.js --bundle --minify --outfile=react-native-live-markdown-parser.js && rm -rf build",
"run": "node react-native-live-markdown-parser.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.24.7",
"@babel/core": "^7.24.7",
"@react-native/babel-preset": "0.73.21",
"@types/underscore": "^1.11.15",
"esbuild": "0.19.4",
"esbuild-plugin-tsc": "^0.4.0",
"jest": "^29.7.0",
"typescript": "^5.3.3"
},
"dependencies": {
"expensify-common": "Expensify/expensify-common#a018512b1e0fce4d4b5a61c00ca826b8887007ad",
"patch-package": "^8.0.0",
"expensify-common": "2.0.10",
"underscore": "^1.13.6"
}
}
178 changes: 0 additions & 178 deletions parser/patches/expensify-common+1.0.0.patch

This file was deleted.

63 changes: 33 additions & 30 deletions parser/react-native-live-markdown-parser.js

Large diffs are not rendered by default.

Loading
Loading