-
Notifications
You must be signed in to change notification settings - Fork 866
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
Content of see cref tag gets dropped #7978
Comments
Here's a unit test that can be added to [Trait("Related", "TripleSlashComments")]
[Fact]
public void SeeAltText()
{
string inputFolder = Path.GetRandomFileName();
Directory.CreateDirectory(inputFolder);
string input = @"
<member name='T:TestClass1.Partial1'>
<summary>
Class summary <see cref='T:System.AccessViolationException'>Exception type</see>
</summary>
<remarks>
See <see cref='T:System.Int'>Integer</see>.
</remarks>
<returns>Returns an <see cref='T:System.AccessViolationException'>Exception</see>.</returns>
<param name='input'>This is an <see cref='T:System.AccessViolationException'>Exception</see>.</param>
</member>";
var context = new TripleSlashCommentParserContext
{
AddReferenceDelegate = null,
PreserveRawInlineComments = false,
Source = new SourceDetail
{
Path = Path.Combine(inputFolder, "Source.cs"),
}
};
var commentModel = TripleSlashCommentModel.CreateModel(input, SyntaxLanguage.CSharp, context);
Assert.True(commentModel.InheritDoc == null, nameof(commentModel.InheritDoc));
var summary = commentModel.Summary;
Assert.Equal("\nClass summary <xref href=\"System.AccessViolationException?text=Exception type\" data-throw-if-not-resolved=\"false\"></xref>\n", summary);
var returns = commentModel.Returns;
Assert.Equal("Returns an <xref href=\"System.AccessViolationException?text=Exception\" data-throw-if-not-resolved=\"false\"></xref>.", returns);
var paramInput = commentModel.Parameters["input"];
Assert.Equal("This is an <xref href=\"System.AccessViolationException?text=Exception\" data-throw-if-not-resolved=\"false\"></xref>.", paramInput);
var remarks = commentModel.Remarks;
Assert.Equal("\nSee <xref href=\"System.Int?text=Integer\" data-throw-if-not-resolved=\"false\"></xref>.\n", remarks);
} |
In Sandcastle, one would use |
But sandcastle would also support content to see tag. It’s quite useful for more than just qualifying classes (this was just one example) but could be to solve grammar or link to more than a member name but a sentence. |
* Adds support for custom text in cref references #7978 * Remove extra line feed * Remove trailing space * Remove preserving formatting, since it'll get escaped by the html formatter
Operating System: Windows
DocFX Version Used: 2.59
Template used: N/A
Steps to Reproduce:
1.
Create two classes with the same member name.
Reference these two in xml doc. We'll use the content of the tag to fully qualify the member, so we can tell the two
Name
properties apart in the generated documentation (otherwise it'll just sayName
for both of them):Expected Behavior:
Generate xref with the content preserved:
Actual Behavior:
Content of the cref is lost.
Note:
Putting the string text inside the xref might not be the correct way. This doc seems to indicate it should be done a different way, but there doesn't seem to be a generic way to create arbitrary text for it (ie just fullname, name etc).
The text was updated successfully, but these errors were encountered: