Can't update document links by overriding UpdateHref method
DocFX Version Used: 2.31
Template used: any template, default or custom Steps to Reproduce:
- Create custom ConceptualDocumentProcessor
- Override the UpdateHref method and update Href of documents like this for example:
public override void UpdateHref(FileModel model, IDocumentBuildContext context) {
if(model.Uids.Length > 0) {
model.Properties.XrefSpec.Href = $"{model.Uids[0].Name}.md";
}
}
Expected Behavior: All links to Conceptual documents are updated correctly accordingly to this code everywhere. In xrefmap.yml, Toc.html and other documents.
Actual Behavior: In xrefmap.yml all link are updated correctly. In Toc.html only part of them is updated every time in random order.
Looks like a bug with parallel document processing or I'm doing something wrong. I'm using custom UpdateHref method in DocumentProcessor because CustomLinkResolver doesn't know about Uid of target document. And I need custom links to hide content behind web application with specific links format.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Sorry for the terribly late reply... I do not get what is your scenario and why it can work partially to update model.Properties.XrefSpec.Href. For conceptual and TOC, as them ends with .html, there href is updated here when parsing the HTML DOM: https://github.com/dotnet/docfx/blob/2e0dd0b1a4aaac2e93ceaec9c792d6521209b855/src/Microsoft.DocAsCode.Build.Engine/TemplateProcessors/TemplateModelTransformer.cs#L373
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.
Closing this issue after a prolonged period of inactivity. If you still think this issue is relevant, please feel free to ping a maintainer or leave a comment.