Skip to content

Commit

Permalink
feat: compute mslearn symbol URL
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeih committed Mar 23, 2023
1 parent 9ff9823 commit 2cee4e3
Show file tree
Hide file tree
Showing 16 changed files with 185,565 additions and 16 deletions.
3 changes: 0 additions & 3 deletions docs/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
"exclude": [ "_site/**", "obj/**" ]
}
],
"xrefService": [
"https://xref.docs.microsoft.com/query?uid={uid}"
],
"postProcessors": [ "ExtractSearchIndex" ],
"globalMetadata": {
"_appTitle": "docfx",
Expand Down
5 changes: 3 additions & 2 deletions docs/tutorial/links_and_cross_references.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ Both will render to:

Another common need is to reference topics from an external project. For example, when you're writing the documentation for your own .NET library, you'll want to add some links that point to types in .NET base class library. DocFX gives you two ways to achieve this functionality: by exporting all UIDs in a project into a map file to be imported in another project, and through cross reference services.

> [!TIP]
> Docfx automatically resolves .NET base class library types and other types published to <https://learn.microsoft.com> by default, without cross reference map or cross reference service. This process does not require network access.
### Cross reference map file

When building a DocFX project, there will be an `xrefmap.yml` generated under output folder. This file contains information for all topics that have UID defined and their corresponding urls. The format of `xrefmap.yml` looks like this:
Expand Down Expand Up @@ -302,8 +305,6 @@ To use a cross reference service, add a `xrefservice` config to the `build` sect
}
```

For example, the URL for the cross reference service for .NET BCL types is `https://xref.docs.microsoft.com/query?uid={uid}`.

## Advanced: more options for cross reference

You can create a cross link with following options:
Expand Down
5 changes: 1 addition & 4 deletions samples/csharp/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
}
],
"dest": "_site",
"exportViewModel": true,
"xrefService": [
"https://xref.docs.microsoft.com/query?uid={uid}"
]
"exportViewModel": true
}
}
4 changes: 1 addition & 3 deletions samples/seed/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
},
"dest": "_site",
"exportViewModel": true,
"xrefService": [ "https://xref.docs.microsoft.com/query?uid={uid}" ],
"template": ["default", "modern"]
},
"pdf": {
Expand All @@ -70,7 +69,6 @@
"filePath": "C:/Program Files/wkhtmltopdf/bin/wkhtmltopdf.exe",
"additionalArguments": "--enable-local-file-access"
},
"dest": "_site_pdf",
"xrefService": [ "https://xref.docs.microsoft.com/query?uid={uid}" ]
"dest": "_site_pdf"
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.Dotnet/Filters/ConfigFilterRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static ConfigFilterRule LoadWithDefaults(string filterConfigFile)
ConfigFilterRule defaultRule, userRule;

var assembly = Assembly.GetExecutingAssembly();
var defaultConfigPath = $"{assembly.GetName().Name}.Filters.defaultfilterconfig.yml";
var defaultConfigPath = $"{assembly.GetName().Name}.Resources.defaultfilterconfig.yml";
using (var stream = assembly.GetManifestResourceStream(defaultConfigPath))
{
using var reader = new StreamReader(stream);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<EmbeddedResource Include="Transform\**" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
<EmbeddedResource Include="Filters\defaultfilterconfig.yml" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
<EmbeddedResource Include="Resources\**" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static class XmlCommentTransformer
static XmlCommentTransformer()
{
var assembly = typeof(XmlCommentTransformer).Assembly;
var xsltFilePath = $"{assembly.GetName().Name}.Transform.XmlCommentTransform.xsl";
var xsltFilePath = $"{assembly.GetName().Name}.Resources.XmlCommentTransform.xsl";
using var stream = assembly.GetManifestResourceStream(xsltFilePath);
using var reader = XmlReader.Create(stream);
var xsltSettings = new XsltSettings(true, true);
Expand Down
Loading

0 comments on commit 2cee4e3

Please sign in to comment.