microsoft / microsoft/vscode-markdown-languageservice

Link detection is not robust

Open
#7 2 comments 0 reactions 1 assignee View on GitHub

@mjbvz is already working on this.

Since Dec 13, 2024.

bug
Dominant language
TypeScript
Stars
438
Forks
25
Avg merge
3d 21h
Merged PRs (30d)
1

Description

Link detection currently uses some terrible regular expressions to find document links. This leads to links incorrectly being detected when they should not be, as well as us missing some potential links. The upside is that the regular expression are pretty fast

Ideally we should instead get the link data from the markdown AST. However markdown-it currently doesn't provide line,column data for link tokens (or even file offsets, unless I've missed something)


I previously explored using tree sitter for this but performance wasn't acceptable. Not sure if that's a fundamental issue or something we could fix. Having the position data from markdown-it though would be a better solution

Relevant issues:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.