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

(markdown) Images with empty alt or links with empty text do not have highlight #3232

Closed
yrccondor opened this issue Jun 7, 2021 · 0 comments · Fixed by #3233
Closed

(markdown) Images with empty alt or links with empty text do not have highlight #3232

yrccondor opened this issue Jun 7, 2021 · 0 comments · Fixed by #3233
Labels
bug help welcome Could use help from community language

Comments

@yrccondor
Copy link

Describe the issue
Images with empty alt or links with empty text do not have highlight

Which language seems to have the issue?
markdown

Are you using highlight or highlightAuto?
highlight

Sample Code to Reproduce

![](https://example.com)

![alt](https://example.com)

[](https://example.com)

[text](https://example.com)

gives out HTML result

![](https://example.com)

![<span class="hljs-string">alt</span>](<span class="hljs-link">https://example.com</span>)

[](https://example.com)

[<span class="hljs-string">text</span>](<span class="hljs-link">https://example.com</span>)

Expected behavior

![](<span class="hljs-link">https://example.com</span>)

![<span class="hljs-string">alt</span>](<span class="hljs-link">https://example.com</span>)

[](<span class="hljs-link">https://example.com</span>)

[<span class="hljs-string">text</span>](<span class="hljs-link">https://example.com</span>)

Additional context

{
begin: /\[.+?\]\[.*?\]/,
relevance: 0
},
// popular internet URLs
{
begin: /\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,
relevance: 2
},
{
begin: regex.concat(/\[.+?\]\(/, URL_SCHEME, /:\/\/.*?\)/),
relevance: 2
},
// relative urls
{
begin: /\[.+?\]\([./?&#].*?\)/,
relevance: 1
},
// whatever else, lower relevance (might not be a link at all)
{
begin: /\[.+?\]\(.*?\)/,
relevance: 0
}

Looks like it will only match square brackets with something in between.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help welcome Could use help from community language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant