UmbrellaDocs / linkspector

Uncover broken links in your content.
Apache License 2.0
55 stars 8 forks source link

[BUG] Links to sections that contain inline code in the heading are reported as broken #72

Closed KStocky closed 2 weeks ago

KStocky commented 2 weeks ago

Describe the bug

If a section heading contains inline code (e.g. inline code), then links to it report as not valid even though they do work.

To Reproduce Steps to reproduce the behavior:

  1. Create a section heading in markdown that contains inline code e.g.

    This contains inline code

  2. Create a link to that section e.g. link

  3. Test that this link does in fact work in vscode or some other markdown viewer

  4. Run linkspector against this markdown file

  5. Observe that linkspector will report this link as broken

Expected behavior

Links to sections that have headings that contain code should be marked as valid when they are.

Additional context

Example actions run - This is an actions run of my repo. It reports that there are 4 broken links but they are all false failures. First issue - This doc is the first issue being flagged in my action run. Contents 3b is the link that is being reported as broken, but if you click it, it works just fine. This (https://github.com/KStocky/ShaderTestFramework/blob/main/docs/TTL/TypeTraits/VoidT.md#2-detecting-if-an-expression-is-valid-using-ttldeclval) is the URL to that specific section which matches the link used in the document.

gaurav-nelson commented 2 weeks ago

Thank you @KStocky

Additionally, Linkspector should also correctly check for anchors for headings with link, images, italic and bold text:

### Heading with `inline code`

### Heading with *italic text*

### Heading with **bold text**

### Heading with [a link](https://example.com)

### Heading with ![an image](https://example.com/image.png)