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

Refine cref handling #55

Merged
merged 13 commits into from
Dec 17, 2023
43 changes: 0 additions & 43 deletions docs/DocMethod.md

This file was deleted.

29 changes: 0 additions & 29 deletions docs/DocType.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/RenderMarkdownPipe.md

This file was deleted.

19 changes: 0 additions & 19 deletions docs/Sample{T0,T1}.Child.md

This file was deleted.

11 changes: 11 additions & 0 deletions docs/Summary.Base.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# [Summary.Base](../src/Core/CrefSample.cs#L5)
```cs
public class Base
```

## Methods
### [Method()](../src/Core/CrefSample.cs#L7)
```cs
public void Method()
```

11 changes: 11 additions & 0 deletions docs/Summary.Base2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# [Summary.Base2](../src/Core/CrefSample.cs#L10)
```cs
public class Base2
```

## Methods
### [Method()](../src/Core/CrefSample.cs#L12)
```cs
public void Method()
```

66 changes: 66 additions & 0 deletions docs/Summary.Caching.CrefCache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# [Summary.Caching.CrefCache](../src/Core/Caching/CrefCache.cs#L9)
```cs
public static partial class CrefCache
```

A cache of different `cref` conversions.

## Methods
### [AsCref(string)](../src/Core/Caching/CrefCache.cs#L30)
```cs
public static string AsCref(this string self)
```

Converts the given string into the format of `cref` attribute value.

#### Example
In the following example, the `"Some<T1, T2>"` string
(which represents the name of some type)
is converted into `"Some{T1,T2}"` as if it was a value of a link
(e.g., <see cref="Some{T1,T2}">):
```cs
var a = "Some<T1, T2>";
var b = a.AsCref();
<br/>
b.Should().Be("Some{T1,T2}");
```

### [AsRawCref(string)](../src/Core/Caching/CrefCache.cs#L51)
```cs
public static string AsRawCref(this string self)
```

Converts the given string into the format of `cref` attribute value
but also removes all generic parameter names.

#### Example
In the following example, the `"Some<T1, T2>"` string
(which represents the name of some type)
is converted into `"Some{,}"`, the raw form of `cref` that can be used for comparisons
without involving generic type parameter names.
```cs
var a = "Some<T1, T2>";
var b = a.AsCref();
<br/>
b.Should().Be("Some{,}");
```

### [FromCref(string)](../src/Core/Caching/CrefCache.cs#L74)
```cs
public static string FromCref(this string self)
```

Converts the given string from the format of `cref` attribute value.

#### Example
In the following example, the `"Some<T1, T2>"` string
In the following example, the `"Some{T1,T2}"` string
(which represents the name of some type in the `cref` format)
is converted into `"Some<T1, T2>` so that it can be displayed somewhere.
```cs
var a = "Some{T1,T2}";
var b = a.AsCref();
<br/>
b.Should().Be("Some<T1, T2>");
```

13 changes: 13 additions & 0 deletions docs/Summary.CrefSample{T0}.Child.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# [Summary.CrefSample<T0>.Child](../src/Core/CrefSample.cs#L17)
```cs
public class Child : Base2
```

## Methods
### [Test()](../src/Core/CrefSample.cs#L22)
```cs
public void Test()
```

[`ClassX.Method2`](./Summary2.ClassX.md#method2)

18 changes: 18 additions & 0 deletions docs/Summary.CrefSample{T0}.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# [Summary.CrefSample<T0>](../src/Core/CrefSample.cs#L15)
```cs
public class CrefSample<T0> : Base
```

## Methods
### [Test()](../src/Core/CrefSample.cs#L22)
```cs
public void Test()
```

[`ClassX.Method2`](./Summary2.ClassX.md#method2)

### [Method()](../src/Core/CrefSample.cs#L28)
```cs
public void Method()
```

20 changes: 15 additions & 5 deletions docs/Doc.md → docs/Summary.Doc.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# [Summary.Doc](../src/Core/Doc.cs#L7)
# [Summary.Doc](../src/Core/Doc.cs#L9)
```cs
public record Doc(DocMember[] Members)
```

A document parsed from the source code or an assembly.

## Fields
### [Empty](../src/Core/Doc.cs#L12)
### [Empty](../src/Core/Doc.cs#L14)
```cs
public static readonly Doc Empty
```

An empty document.

## Properties
### [Members](../src/Core/Doc.cs#L7)
### [Members](../src/Core/Doc.cs#L9)
```cs
public DocMember[] Members { get; }
```

The sequence of members this doc contains.

## Methods
### [Merge(Doc, Doc)](../src/Core/Doc.cs#L19)
### [Merge(Doc, Doc)](../src/Core/Doc.cs#L21)
```cs
public static Doc Merge(Doc a, Doc b)
```
Expand All @@ -33,10 +33,20 @@ Merges two documents together returning the new merged document.
- `a`: The first document to merge.
- `b`: The second document to merge.

### [Declaration(DocType?<DocType>)](../src/Core/Doc.cs#L24)
### [Declaration(DocType?<DocType>)](../src/Core/Doc.cs#L29)
```cs
public DocTypeDeclaration? Declaration(DocType? type)
```

A type declaration that matches the specified type.

### [Cref(DocCommentLink)](../src/Core/Doc.cs#L32)
```cs
public DocMember? Cref(DocCommentLink link)
```

### [Cref(string, DocMember)](../src/Core/Doc.cs#L35)
```cs
public DocMember? Cref(string value, DocMember scope)
```

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record DocCommentElement(string Name, DocCommentElementAttribute[] Attributes, DocCommentNode[] Nodes) : DocCommentNode
```

A [`DocCommentNode`](./DocCommentNode.md) that represents a compound element (e.g. summary, remarks, and other XML elements).
A [`DocCommentNode`](./Summary.DocCommentNode.md) that represents a compound element (e.g. summary, remarks, and other XML elements).

_Each element can contain simple text as well as other elements._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record DocCommentInheritDoc(string? Cref) : DocCommentNode
```

A [`DocCommentNode`](./DocCommentNode.md) that inherits documentation from another member
A [`DocCommentNode`](./Summary.DocCommentNode.md) that inherits documentation from another member
(`<inheritdoc>`).

## Properties
Expand Down
2 changes: 1 addition & 1 deletion docs/DocCommentLink.md → docs/Summary.DocCommentLink.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record DocCommentLink(string Value) : DocCommentNode
```

A [`DocCommentNode`](./DocCommentNode.md) that represents the link to other member (e.g. `<see cref="SomeMember"/>`).
A [`DocCommentNode`](./Summary.DocCommentNode.md) that represents the link to other member (e.g. `<see cref="SomeMember"/>`).

## Properties
### [Value](../src/Core/DocCommentLink.cs#L8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record DocCommentLiteral(string Value, string LeadingTrivia = "") : DocCommentNode
```

A [`DocCommentNode`](./DocCommentNode.md) that represents a literal value (e.g. text, space, newline character, etc.).
A [`DocCommentNode`](./Summary.DocCommentNode.md) that represents a literal value (e.g. text, space, newline character, etc.).

_Literals are simple tokens that are parsed as text._

Expand All @@ -28,5 +28,5 @@ The leading trivia of the literal that is not included in the `Value`(i.e. space
public static DocCommentLiteral New(string value)
```

Constructs a new [`DocCommentLiteral`](./DocCommentLiteral.md) from the given string.
Constructs a new [`DocCommentLiteral`](./Summary.DocCommentLiteral.md) from the given string.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record DocCommentParamRef(string Value) : DocCommentNode
```

A [`DocCommentNode`](./DocCommentNode.md) that represents the reference to a parameter
A [`DocCommentNode`](./Summary.DocCommentNode.md) that represents the reference to a parameter
(`<paramref>`, `<typeparamref>`).

## Properties
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/DocField.md → docs/Summary.DocField.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record DocField : DocMember
```

A [`DocMember`](./DocMember.md) that represents a documented field in the parsed source code.
A [`DocMember`](./Summary.DocMember.md) that represents a documented field in the parsed source code.

## Properties
### [Type](../src/Core/DocField.cs#L11)
Expand Down
2 changes: 1 addition & 1 deletion docs/DocIndexer.md → docs/Summary.DocIndexer.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record DocIndexer : DocProperty
```

A [`DocProperty`](./DocProperty.md) that represents an indexer.
A [`DocProperty`](./Summary.DocProperty.md) that represents an indexer.

## Properties
### [Params](../src/Core/DocIndexer.cs#L11)
Expand Down
File renamed without changes.
Loading