Ellerbach / docfx-companion-tools

A suite of tools, pipelines templates to take the very best of DocFX
MIT License
64 stars 18 forks source link

DocLinkChecker Doesn't understand File Inclusion links #29

Open AMSDavis opened 1 year ago

AMSDavis commented 1 year ago

When running DocLinkChecker it appears that the checker doesn't understand or find the links if I am using a file inclusion with a Code Snippet.

These links are rendered just find by docfx however DocLinkChecker believes they are an error.

As an example, if I have the following structure:

doc/
    index.md
    docfx.json
    scripts/
        foo.cs

and foo.cs has the following content like this:

// (other content above)

// <Bravo>
foreach(var thing in list)
{
     // Do Stuff
}
// </Bravo>

I can include the entire file with:

[!code-csharp[Code](~/Scripts/foo.cs)]

But this will be detected as an error by DocLinkChecker:

[!code-csharp[Code](~/Scripts/foo.cs?name=Bravo)]
Ellerbach commented 1 year ago

This should be fixed in a coming release. See https://github.com/Ellerbach/docfx-companion-tools/tree/doclinkchecker-upgrade You can build and test it to check if it now works better. Please report back if possible.

Ellerbach commented 9 months ago

@AMSDavis did you have a chance to test the new version published? It should fix your issue! Let us know so we can close this issue.

Pixelrella commented 8 months ago

Hello!

Just got the same issue in version 1.15.0.

I get warnings for line and region inclusions of csharp code snippets:

[!code-csharp[](../DemoProject/MyFile.cs#starting)]
private void MyMethod()
{
   #region starting
   // Some code
   #endregion
}

***WARNING Heading 'starting' not found in '../DemoProject/MyFile.cs'

Maybe this should be reported as separate issue, but I am also getting warnings for tabs:

## [Guide](#tab/text)

***WARNING Heading 'tab/text' not found in '.\Tabbed.md

Thank you!

mtirionMSFT commented 8 months ago

@Pixelrella sorry about that. I haven't had time to test that scenario. I have added this to the backlog.

mtirionMSFT commented 7 months ago

@Pixelrella I've been investigating this problem and it's harder then it looks. The functionality you are describing is not standard markdown (supported by markdig), but it's special for DocFx. There use to be a special markdig extension for these DocFx specials, but that's not supported anymore. I'm trying to see if there is a way to 'easily' add this support, otherwise I might end up writing our own markdig extension to solve this. But this will probably take some time.

So, just to let you know we're working on it :)