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

DocLinkChecker Doesn't understand File Inclusion links #29

Closed
AMSDavis opened this issue May 5, 2023 · 6 comments
Closed

DocLinkChecker Doesn't understand File Inclusion links #29

AMSDavis opened this issue May 5, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@AMSDavis
Copy link

AMSDavis commented May 5, 2023

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 Ellerbach added the bug Something isn't working label May 16, 2023
@Ellerbach
Copy link
Owner

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
Copy link
Owner

@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
Copy link

Pixelrella commented Nov 7, 2023

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
Copy link
Collaborator

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

@mtirionMSFT
Copy link
Collaborator

@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 :)

@mtirionMSFT
Copy link
Collaborator

mtirionMSFT commented Aug 20, 2024

@AMSDavis @Pixelrella Sometimes it's good to drop things for a while and then come back to it ... to find that it is really simple to solve. I have solved this issue in PR #58. The fix will be released soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants