Skip to content

fix: multiple links next to each other are resolved as single link - #35

Open
lopo12123 wants to merge 3 commits into
Infinitix-LLC:mainfrom
lopo12123:main
Open

fix: multiple links next to each other are resolved as single link#35
lopo12123 wants to merge 3 commits into
Infinitix-LLC:mainfrom
lopo12123:main

Conversation

@lopo12123

Copy link
Copy Markdown

Trying to fix #34


The test case is as follows

final cases = [
  // (raw content, expected)
  ('![link](url)', 0),
  ('[link](url)', 1),
  ('[li\nnk](url)', 0),
  ('[link](u\nrl)', 0),
  ('[li\\]nk](url)', 1),
  ('[link](ur\\)l)', 1),
  ('[link](url)[link2](url2)', 2),
  ('[link](url) [link2](url2)', 2),
];

void main() {
  final reg = RegExp(
    r"(?<!!)\[((?:[^\]\n]|\\\])*)\]\(((?:[^)\n]|\\\))*)\)",
    dotAll: true,
    multiLine: true,
  );

  for (final entry in cases) {
    print(
        "${entry.$1.replaceAll('\n', '\\n')} => ${reg.allMatches(entry.$1).length}/${entry.$2}");
  }
}

image

1. duplicated declare of 'ImageMd'
2. reg of 'ImageMd'
incorrect usage of 'Expanded'
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.

continuous link parsing errors

1 participant