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

[QUESTION] - Markdown square-bracket links #632

Open
Michota opened this issue Mar 6, 2025 · 4 comments
Open

[QUESTION] - Markdown square-bracket links #632

Michota opened this issue Mar 6, 2025 · 4 comments
Labels
question Further information is requested

Comments

@Michota
Copy link

Michota commented Mar 6, 2025

Am I doing something wrong, or the parser simply does not support the inner links ([[filename]]) syntax?
If I understand correctly, the ExpansiMark does in fact follow this syntax, right? That's how I understand this regex:

const MARKDOWN_LINK_REGEX = new RegExp(`\\[([^\\][]*(?:\\[[^\\][]*][^\\][]*)*)]\\(${UrlPatterns.MARKDOWN_URL_REGEX}\\)(?![^<]*(<\\/pre>|<\\/code>))`, 'gi');

If not, can I implement this function by modyfing parseExpensiMark.ts, or do I need to dig under the hood, in the ExpansiMark itself?

Is there any tutorial or documentation article which would guide me how to add custom syntaxes for markdown?

@tomekzaw tomekzaw added the question Further information is requested label Mar 6, 2025
@tomekzaw
Copy link
Collaborator

tomekzaw commented Mar 6, 2025

Hi @Michota, as far as I know ExpensiMark doesn't support [[filename]] syntax. When it comes to links, ExpensiMark supports regular links (like https://example.com) and labeled links (like [label](https://example.com)).

Perhaps it would be the best to implement it directly in expensify-common (most likely as a patch in your app because it's unlikely that this will be merged into main). Alternatively, you can do some preprocessing in parseExpensiMark.ts. I'm afraid currently there are no tutorials on how extend Markdown syntax, though.

Keep in mind that you can also implement your own Markdown parser (it must be workletized, though) and pass it to parser prop in MarkdownTextInput, see the example in README: https://github.com/Expensify/react-native-live-markdown?tab=readme-ov-file#parsing-logic

@tomekzaw tomekzaw changed the title [QUESTION] - Makrdown square-bracket links [QUESTION] - Markdown square-bracket links Mar 6, 2025
@tomekzaw
Copy link
Collaborator

tomekzaw commented Mar 7, 2025

@Michota Just wanted to ask, do you use react-native-live-markdown with the New Architecture enabled?

We're considering dropping support for the old architecture since Expensify uses this library only on the new architecture and we don't really maintain the old implementation for Paper.

@Michota
Copy link
Author

Michota commented Mar 7, 2025

Weird thing: I have newArchEnabled=true setting set in graddle.properties, and i set { "expo": { "newArchEnabled": true } } yet when I console.log(global?.nativeFabricUIManager) it returns false, which suggest, that I use Paper... or maybe I am doing something wrong?

@tomekzaw
Copy link
Collaborator

tomekzaw commented Mar 7, 2025

@Michota Try global.RN$Bridgeless

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants